1 Star 0 Fork 0

dev-tang/flutter_rust_bridge

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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

Rust Package Flutter Package Stars CI 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, 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

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

📎 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.

✨ Contributors

All Contributors

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

fzyzcjy
fzyzcjy

💻 📖 💡 🤔 🚧
Viet Dinh
Viet Dinh

💻 ⚠️ 📖
Joshua Wade
Joshua Wade

💻
Marcel
Marcel

💻
rustui
rustui

📖
Michael Bryan
Michael Bryan

💻
bus710
bus710

📖
Sebastian Urban
Sebastian Urban

💻
Daniel
Daniel

💻
Kevin Li
Kevin Li

💻 📖
Patrick Auernig
Patrick Auernig

💻
Anton Lazarev
Anton Lazarev

💻
Unoqwy
Unoqwy

💻
Febrian Setianto
Febrian Setianto

📖
syndim
syndim

💻
sagu
sagu

💻 📖
Ikko Ashimine
Ikko Ashimine

📖
alanlzhang
alanlzhang

💻 📖
Sai Chaitanya
Sai Chaitanya

💻
Ares Andrew
Ares Andrew

📖
raphaelrobert
raphaelrobert

📖
thomas725
thomas725

📖
Daniel Porteous (dport)
Daniel Porteous (dport)

📖
Wouter Ensink
Wouter Ensink

📖
老董
老董

💻 📖
Lattice 0
Lattice 0

💻 📖
orange soeur
orange soeur

📖
Roms
Rom's

💻 📖
Cupnfish
Cupnfish

💻
SoLongAnd...
SoLongAnd...

💻 📖
Sam Nystrom
Sam Nystrom

📖
hsfzxjy
hsfzxjy

💻
muji
muji

📖
Zaitam
Zaitam

💻
Alex Procelewski
Alex Procelewski

📖 💻
Vincent Herlemont
Vincent Herlemont

💻
CicadaCinema
CicadaCinema

💻 📖
rogurotus
rogurotus

💻 📖
huang12zheng
huang12zheng

💻 📖
Sven-Hendrik Haase
Sven-Hendrik Haase

📖
Nicolas Gasull
Nicolas Gasull

💻
codercengiz
codercengiz

💻
Fabian Löschner
Fabian Löschner

💻
Gregory Conrad
Gregory Conrad

📖 💻
Roman Zaynetdinov
Roman Zaynetdinov

📖
jsonmona
jsonmona

💻
Chris Ohk
Chris Ohk

📖
._.
._.

📖
elliotsayes
elliotsayes

📖
Kim Dong-Hyun
Kim Dong-Hyun

💻 📖
Alex Gorichev
Alex Gorichev

📖
nitn3lav
nitn3lav

💻 📖
polypixeldev
polypixeldev

📖
Andrii Stadnik
Andrii Stadnik

💻
Brent Lewis
Brent Lewis

💻 📖
Erikas Taroza
Erikas Taroza

💻
J
J

📖
Andreas Monitzer
Andreas Monitzer

💻
Satvik Pendem
Satvik Pendem

💻
Philip Kannegaard Hayes
Philip Kannegaard Hayes

💻
thesimplekid
thesimplekid

📖
Akash Jaiswal
Akash Jaiswal

📖
Manuel Philipp
Manuel Philipp

💻 📖
Jonathan
Jonathan

📖
菘菘
菘菘

💻
Marc Gutenberger
Marc Gutenberger

💻
Aran Donohue
Aran Donohue

💻
Aidan
Aidan

📖
max
max

📖
Mouayad Alhamwi
Mouayad Alhamwi

📖
NightFeather
NightFeather

💻
SimplyKyle!
SimplyKyle!

💻
Xidorn Quan
Xidorn Quan

💻
Vitalii Hurianov
Vitalii Hurianov

📖
九月
九月

💻

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 sealed freezed class in Dart. Support the Option type as nullable types in Dart. Support Vec of Strings type. Support tuple 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. Precompiled binary CI workflow. Fix bugs. Add support for the Web platform, parallel to the existing mobile/desktop platforms, via WASM and JavaScript as intermediate values. GitHub retry actions. Implement draft of opaque types. Refactor Boxed and Option. Impl list of dates and optionals. Parameter defaults. Refactor CLI. Refactor codegen errors.
  • 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 SyncReturn for more types. Fix generation bug. Fix SyncReturn. Migrate to dart-sys. Update CI. Fix linters. Fix SyncReturn bug. Fix rustfmt::skip.
  • 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_cobject error with ffigen 6.0.
  • lattice0: Implement hierarchy of exceptions. Support methods, such that Rust struct impls can be converted to Dart class methods. StreamSink at any argument.
  • 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.
  • 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 ffigen dependency. 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.
  • dbsxdbsx: Allow generating multiple Rust and Dart files. Fix lint. Update doc. Add logging.
  • huang12zheng: Support type aliases and nested ones. Tweak code generation. Fix rust_build_and_test on Mac. Improve CI logic and cache. Remove bridge field in model.
  • trobanga: Add support for [T;N] structs. Add usize support. Add a cmd argument. Separate dart tests. Fix fallible list case.
  • MnlPhlp: Support macros and will auto expand. Allow mirror types in streams.
  • SoLongAndThanksForAllThePizza: Refactor and enhance SyncReturn to support more types. Refactor post-release CI.
  • 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. Fix enum in struct. Fix linter.
  • temeddix: Fix broken CI. Custom num workers. Fix MacOS doc steps. Update doc. Make zero-copy defaultable.
  • Zaitam: Fix when method return struct. Partial migration to Dart 3.
  • erikas-taroza: Support list of primitive enums. Make enum camelCase. Warn wrong path. Fix cargo expand.
  • nitn3lav: nested structs without Box.
  • alexthe2: Add Option Datetime. Add empty structs. Improve doc. Add r#. Fix mirror enum bug.
  • SiongSng: Finish implementing exception hierarchy. Fix SyncReturn bug.
  • AlienKevin: Add flutter example for macOS. Add doc for Android NDK bug.
  • banool: Fix pubspec parsing. Fix symbol-stripping doc.
  • coder0xff: Refactor SupportedInnerType. Extra codegen tester.
  • anlumo: Fix freezed + methods. Non-clone RustOpaque.
  • NightFeather0615: Fix Vec bool.
  • OfficialBoyfriend: Fix error display.
  • powpingdone: Document JNI init and libc++_static linking.
  • efc-mw: Improve Windows encoding handling.
  • valeth: Rename callFfi's port.
  • sccheruku: Prevent double-generating utility.
  • jsonmona: Add import.
  • upsuper: Refactor delegate-attr.
  • w-ensink: Improve doc. Fix CI. Refactor. Add tests.
  • codercengiz: Fix mirroring bug.
  • Michael-F-Bryan: Detect broken bindings.
  • phlip9: Fix no-serde compilation.
  • bus710: Add a case in troubleshooting.
  • Demezy: Mention troubleshooting.
  • gutenfries: Bump proc-macros.
  • anstadnik: Check keywords.
  • aran: Fix pubspec. Bump version.
  • Syndim: Add a bracket to box.
  • TENX-S: Improve doc. Reproduce a bug.
  • polypixeldev: Improve doc.
  • CicadaCinema: Bump version. Improve doc.
  • w1th0utnam3: Improve message.
  • vincent-herlemont: Loosen version.
  • zaynetro: Improve doc.
  • raphaelrobert: Remove oudated doc.
  • DMouayad: Improve doc.
  • elliotsayes: Improve doc.
  • tmpfs: Improve doc.
  • thomas725: Improve doc.
  • juzi5201314: Improve doc.
  • Voklen: Improve doc.
  • svenstaro: Improve doc.
  • utilForever: Fix typos.
  • not-holar: Fix typos.
  • Stonks3141: Fix doc credit.
  • vimaxwell: Fix doc link.
  • lker-dev: Fix doc link.
  • jaiakash: Fix doc link.
  • feber: Fix doc link.
  • satvikpendem: Little co-work #989.
  • rustui: Fix a typo.
  • escwxyz: Fix a typo.
  • eltociear: Fix a typo.
  • thesimplekid: Fix a typo.
MIT License Copyright (c) 2021 fzyzcjy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Mirror https://github.com/fzyzcjy/flutter_rust_bridge 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Rust
1
https://gitee.com/dev-tang/flutter_rust_bridge.git
git@gitee.com:dev-tang/flutter_rust_bridge.git
dev-tang
flutter_rust_bridge
flutter_rust_bridge
master

搜索帮助

371d5123 14472233 46e8bd33 14472233