Skip to content

Commit cbf5fe5

Browse files
committed
resolved flutter errors
1 parent b2fb487 commit cbf5fe5

6 files changed

Lines changed: 42 additions & 16 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ name = "encrypted_upload_test"
7777
path = "examples/encrypted_upload_test.rs"
7878

7979
[workspace.package]
80-
version = "0.3.1"
80+
version = "0.3.2"
8181
edition = "2021"
8282
license = "MIT OR Apache-2.0"
8383
repository = "https://github.com/functionland/fula-api"

crates/fula-flutter/src/api/forest.rs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ pub async fn list_from_forest(
143143
/// This is critical for large files (1GB+) where passing `Vec<u8>` through
144144
/// FFI would cause out-of-memory errors.
145145
#[cfg(not(target_arch = "wasm32"))]
146-
#[flutter_rust_bridge::frb(ignore)]
147146
pub async fn put_flat_from_path(
148147
client: &EncryptedClientHandle,
149148
bucket: String,
@@ -163,11 +162,21 @@ pub async fn put_flat_from_path(
163162
Ok(result.into())
164163
}
165164

165+
#[cfg(target_arch = "wasm32")]
166+
pub async fn put_flat_from_path(
167+
_client: &EncryptedClientHandle,
168+
_bucket: String,
169+
_path: String,
170+
_file_path: String,
171+
_content_type: Option<String>,
172+
) -> anyhow::Result<PutResult> {
173+
anyhow::bail!("put_flat_from_path is not supported on WASM; read the file in Dart and call put_flat")
174+
}
175+
166176
/// Upload a file from a local path without immediate forest save (deferred)
167177
///
168178
/// Same as `put_flat_from_path` but defers the forest save for batch efficiency.
169179
#[cfg(not(target_arch = "wasm32"))]
170-
#[flutter_rust_bridge::frb(ignore)]
171180
pub async fn put_flat_from_path_deferred(
172181
client: &EncryptedClientHandle,
173182
bucket: String,
@@ -187,15 +196,30 @@ pub async fn put_flat_from_path_deferred(
187196
Ok(result.into())
188197
}
189198

199+
#[cfg(target_arch = "wasm32")]
200+
pub async fn put_flat_from_path_deferred(
201+
_client: &EncryptedClientHandle,
202+
_bucket: String,
203+
_path: String,
204+
_file_path: String,
205+
_content_type: Option<String>,
206+
) -> anyhow::Result<PutResult> {
207+
anyhow::bail!("put_flat_from_path_deferred is not supported on WASM; read the file in Dart and call put_flat_deferred")
208+
}
209+
190210
/// Get the size of a file without reading it into memory
191211
#[cfg(not(target_arch = "wasm32"))]
192-
#[flutter_rust_bridge::frb(ignore)]
193212
pub async fn get_file_size(file_path: String) -> anyhow::Result<u64> {
194213
let metadata = tokio::fs::metadata(&file_path).await
195214
.with_context(|| format!("Failed to get file metadata: {}", file_path))?;
196215
Ok(metadata.len())
197216
}
198217

218+
#[cfg(target_arch = "wasm32")]
219+
pub async fn get_file_size(_file_path: String) -> anyhow::Result<u64> {
220+
anyhow::bail!("get_file_size is not supported on WASM; use the browser File API in Dart")
221+
}
222+
199223
// ============================================================================
200224
// Subtree Operations (for Sharing)
201225
// ============================================================================

crates/fula-flutter/src/api/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ pub use forest::{
8080
get_forest_subtree,
8181
};
8282

83-
// Re-export file-path-based functions (native only)
84-
#[cfg(not(target_arch = "wasm32"))]
83+
// Re-export file-path-based functions. Native impls read the file directly on
84+
// the Rust side (avoiding the FFI round-trip for 1GB+ files); WASM impls
85+
// return an error since browsers don't expose filesystem paths — WASM callers
86+
// should read the file themselves and use `put_flat`.
8587
pub use forest::{
8688
put_flat_from_path,
8789
put_flat_from_path_deferred,

packages/fula_client/ios/fula_client.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Pod::Spec.new do |s|
88
s.name = 'fula_client'
9-
s.version = '0.3.1'
9+
s.version = '0.3.2'
1010
s.summary = 'Flutter SDK for Fula decentralized storage'
1111
s.description = <<-DESC
1212
A Flutter plugin providing client-side encryption, metadata privacy,

packages/fula_client/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: fula_client
22
description: Flutter SDK for Fula decentralized storage with client-side encryption, metadata privacy, and secure sharing.
3-
version: 0.3.1
3+
version: 0.3.2
44
homepage: https://fx.land
55
repository: https://github.com/functionland/fula-api
66
issue_tracker: https://github.com/functionland/fula-api/issues

0 commit comments

Comments
 (0)