A Dart binding for Apache OpenDAL: access S3, GCS, Azure Blob, the local filesystem, and 50+ more services through one API. Built on the Rust core via flutter_rust_bridge.
We release the OpenDAL Dart binding independently of the opendal crate (Rust core). For updates and compatibility, use the Dart binding version instead of the opendal crate version.
examples/bindings/dart/This binding is not yet published to pub.dev. To use it, clone the repository and add it as a path dependency, or work directly from bindings/dart/.
You must compile the Rust native library first:
cd rust cargo build -r cd .. dart pub get
The loader first looks for the library in the platform-specific target-triple directory (e.g. rust/target/aarch64-apple-darwin/release/), then falls back to rust/target/release/. For cross-compiled targets, build with --target <triple> so the library is placed in the matching target directory.
import 'dart:typed_data'; import 'package:opendal/opendal.dart'; void main() async { final storage = await Storage.init(schemeStr: "memory", map: {"root": "/"}); final File = storage.initFile(); final file = File("hello.txt"); await file.write(Uint8List.fromList("Hello, OpenDAL!".codeUnits)); final data = await file.read(); print(String.fromCharCodes(data)); // Hello, OpenDAL! await file.delete(); }
The API mirrors dart:io — Storage.initFile() and Storage.initDir() return factory functions that behave like dart:io's File and Directory.
Every method has a blocking *Sync variant alongside the async Future<T> form.
See the user guide for more examples and a full operations reference.
Run tests after building the native library:
dart test
Update generated code when upgrading flutter_rust_bridge:
flutter_rust_bridge_codegen version.flutter_rust_bridge in both pubspec.yaml and rust/Cargo.toml.flutter_rust_bridge_codegen generate.cargo build -r from rust/.dart test to verify.The codegen version recorded in generated files, lib/src/rust/frb_generated.dart, and rust/src/frb_generated.rs must all match. Version drift causes startup or test failures.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation.