Syndim / flutter_rust_bridge

High-level memory-safe binding generator for Flutter/Dart <-> Rust

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flutter_rust_bridge: High-level memory-safe binding generator for Flutter/Dart <-> Rust

Rust Package Flutter Package Stars CI Example Codacy Badge

Logo

Want to combine the best between Flutter, a cross-platform hot-reload rapid-development UI toolkit, and Rust, a language empowering everyone to build reliable and efficient software? Here it comes!

πŸš€ Advantages

  • Memory-safe: Never need to think about malloc/free.
  • Feature-rich: enums with values, platform-optimized Vec, possibly recursive struct, zero-copy big arrays, 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).
  • 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).
  • Multi-platform: Android, iOS, Windows, Linux, MacOS (Web coming soon)
  • 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

Check out the user guide for show-me-the-code, tutorials, features and much more.

✨ Contributors

All Contributors

Thanks goes to these wonderful people (emoji key following all-contributors specification):


fzyzcjy

πŸ’» πŸ“– πŸ’‘ πŸ€” 🚧

Viet Dinh

πŸ’» ⚠️ πŸ“–

Joshua Wade

πŸ’»

Marcel

πŸ’»

rustui

πŸ“–

Michael Bryan

πŸ’»

bus710

πŸ“–

Sebastian Urban

πŸ’»

Daniel

πŸ’»

Kevin Li

πŸ’» πŸ“–

Patrick Auernig

πŸ’»

Anton Lazarev

πŸ’»

Unoqwy

πŸ’»

Febrian Setianto

πŸ“–

More specifically, thanks for all these contributions:

  • Desdaemon: Support not only simple enums but also enums with fields which gets translated to native enum or freezed class in Dart. Support the Option type as nullable types in Dart. Support Vec of Strings type. Support comments in code. Add marker attributes for future usage. Add Linux and Windows support for with-flutter example, and make CI works for that. Avoid parameter collision. Overhaul the documentation and add several chapters to demonstrate configuring a Flutter+Rust project in all five platforms. Refactor command module.
  • SecondFlight: Allow structs and enums to be imported from other files within the crate by creating source graph. Auto-create relavent dir.
  • 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.
  • AlienKevin: Add flutter example for macOS.
  • surban: Support unit return type. Skip unresolvable modules. Ignore prefer_const_constructors.
  • efc-mw: Improve Windows encoding handling.
  • valeth: Rename callFfi's port.
  • trobanga: Add a cmd argument.
  • Michael-F-Bryan: Detect broken bindings.
  • bus710: Add a case in troubleshooting.
  • feber: Fix doc link.
  • rustui: Fix a typo.

About

High-level memory-safe binding generator for Flutter/Dart <-> Rust

https://fzyzcjy.github.io/flutter_rust_bridge/

License:MIT License


Languages

Language:Rust 44.4%Language:Dart 32.4%Language:JavaScript 13.7%Language:C++ 3.3%Language:CMake 2.8%Language:C 1.4%Language:HTML 0.6%Language:Python 0.6%Language:Ruby 0.4%Language:Swift 0.2%Language:Shell 0.1%Language:Kotlin 0.0%Language:Objective-C 0.0%