|new 1.62.1||Feb 4, 2023|
|1.59.0||Dec 29, 2022|
|1.51.0||Nov 29, 2022|
|1.38.2||Jul 30, 2022|
|1.8.0||Nov 27, 2021|
#81 in FFI
22,542 downloads per month
flutter_rust_bridge: High-level memory-safe binding generator for Flutter/Dart <-> Rust
- Memory-safe: Never need to think about malloc/free.
enums with values, platform-optimized
Vec, possibly recursive
struct, zero-copy big arrays, opaque types on arbitrary structs/classes,
Stream(iterator) abstraction, error (
Result) handling, cancellable tasks, concurrency control, and more. See full features here.
- Async programming: Rust code will never block the Flutter. Call Rust naturally from Flutter's main isolate (thread); sync mode also equally supported.
- Lightweight: This is not a huge framework that includes everything, so you are free to use your favorite Flutter and Rust libraries. For example, state-management with Flutter library (e.g. MobX) can be elegant and simple (contrary to implementing in Rust); implementing a photo manipulation algorithm in Rust will be fast and safe (countrary to implementing in Flutter).
- Cross-platform: Android, iOS, Windows, Linux, MacOS, and Web.
- Easy to code-review & convince yourself: This package simply simulates how humans write boilerplate code. If you want to convince yourself (or your team) that it is safe, there is not much code to look at. No magic at all! (More about safety concerns.)
- Fast: It is only a thin (though feature-rich) wrapper, without overhead such as protobuf serialization, thus performant. (More benchmarks later) (Throw away components like thread-pool to make it even faster)
- Pure-Dart compatible: Despite the name, this package is 100% compatible with pure Dart.
💡 User Guide
📎 P.S. Achieve ~60 FPS, no matter how janky the Flutter app was due to build/layout
Here is my another open-source library :) https://github.com/fzyzcjy/flutter_smooth.
More specifically, thanks for all these contributions:
- rogurotus: Add Rust opaque types, enabling arbitrary Rust structs to be used as opaque Dart objects by generating wrappers and raw Arc pointers, as well as Dart opaque types, allowing to use any Dart objects in Rust code. Extend
SyncReturnfor more types. Fix generation bug. Fix SyncReturn. Migrate to dart-sys. Update CI. Fix linters.
- ngasull: Make sync mode support whatever types that classical async mode supports. Bump sdk.
- SecondFlight: Allow structs and enums to be imported from other files within the crate by creating source graph. Auto-create relevant dir. Fix
store_dart_post_cobjecterror with ffigen 6.0.
- Unoqwy: Add struct mirrors, such that types in the external crates can be imported and used without redefining and copying.
- antonok-edm: Avoid converting syn types to strings before parsing to improve code and be more robust.
- lattice0: Support methods, such that Rust struct impls can be converted to Dart class methods. StreamSink at any argument.
- sagudev: Make code generator a
lib. Add error types. Depend on
cbindgen. Fix LLVM paths. Update deps. Fix CI errors.
- surban: Support unit return type. Skip unresolvable modules. Ignore prefer_const_constructors. Non-final Dart fields.
- Roms1383: Fix build_runner calling bug. Remove global
ffigendependency. Improve version check. Fix enum name-variant conflicts. Support Chrono date time and UUID types. Migrate to Rust 1.64 workspace. Update and refactor CI. Update header comments. Code cleanup.
- GregoryConrad: Add doc to setup frb inside a Dart/Flutter library.
- trobanga: Add support for
usizesupport. Add a cmd argument. Separate dart tests.
- dbsxdbsx: Allow generating multiple Rust and Dart files. Fix lint. Update doc. Add logging.
- SoLongAndThanksForAllThePizza: Refactor and enhance SyncReturn to support more types.
- huang12zheng: Support type aliases and nested ones. Tweak code generation.
- hsfzxjy: Fix SyncReturn use-after-free bug.
- Cupnfish: Support arrays as function parameters. Allow multi mirror.
- alanlzhang: Add generation for Dart metadata. Enhance module parser.
- Zaitam: Fix when method return struct.
- AlienKevin: Add flutter example for macOS. Add doc for Android NDK bug.
- banool: Fix pubspec parsing. Fix symbol-stripping doc.
- efc-mw: Improve Windows encoding handling.
- valeth: Rename callFfi's port.
- sccheruku: Prevent double-generating utility.
- jsonmona: Add import.
- w-ensink: Improve doc. Fix CI. Refactor. Add tests.
- codercengiz: Fix mirroring bug.
- Michael-F-Bryan: Detect broken bindings.
- bus710: Add a case in troubleshooting.
- Demezy: Mention troubleshooting.
- Syndim: Add a bracket to box.
- TENX-S: Improve doc. Reproduce a bug.
- CicadaCinema: Bump version. Improve doc.
- w1th0utnam3: Improve message.
- vincent-herlemont: Loosen version.
- zaynetro: Improve doc.
- raphaelrobert: Remove oudated doc.
- alexthe2: Improve doc.
- tmpfs: Improve doc.
- thomas725: Improve doc.
- juzi5201314: Improve doc.
- svenstaro: Improve doc.
- utilForever: Fix typos.
- Stonks3141: Fix doc credit.
- feber: Fix doc link.
- rustui: Fix a typo.
- eltociear: Fix a typo.