Skip to content

Template for Flutter + Rust integration with flutter_rust_bridge.

Notifications You must be signed in to change notification settings

Pierre-Monier/flutter_rust_bridge_template

 
 

Repository files navigation

flutter_rust_bridge_template

This repository serves as a template for Flutter projects calling into native Rust libraries via flutter_rust_bridge.

Getting Started

To begin, ensure that you have a working installation of the following items:

echo "ANDROID_NDK=.." >> ~/.gradle/gradle.properties

This template use just to get things done. You should download it.

It also use flutter_rust_bridge_codegen, so you should have it install on your machine. You can install it with cargo install flutter_rust_bridge_codegen

You also need to make sure that you have llvm install.

You can install it as follow:

  • ubuntu/linux
sudo apt-get install libclang-dev
  • Windows
winget install -e --id LLVM.LLVM
  • MacOs
brew install llvm

Then go ahead and run flutter run! When you're ready, refer to our documentation here to learn how to write and use binding code.

Once you have edited api.rs to incorporate your own Rust code, the bridge files bridge_definitions.dart and bridge_generated.dart are generated using the following command:

Generate

If you have already install just, you can just run just command line and it will build everythings for you. You can check the detail of what the just command does in the justfile. To run a specific task, use just <taskname>

Scaffolding in existing projects

If you would like to generate boilerplate for using flutter_rust_bridge in your existing projects, check out the flutter_rust_bridge brick for more details.

About

Template for Flutter + Rust integration with flutter_rust_bridge.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 45.8%
  • Rust 15.6%
  • Ruby 14.9%
  • Shell 6.7%
  • HTML 5.2%
  • C 4.6%
  • Other 7.2%