r/flutterhelp • • Mar 02 '23

OPEN The point of using Rust with Flutter

Does it make sense to Rust with Flutter? Business logic will be written in Rust and the rest in Dart. I haven't written the code in Dart yet, and before I start I would like to know about this possibility

18 Upvotes

17 comments sorted by

6

u/BrutalCoding Mar 02 '23

Here’s your golden ticket:

https://github.com/AppFlowy-IO/AppFlowy

That’s a Flutter app with Rust combined, as an open source alternative to Notion. Repo has like 30K+ stars, quite insane.

1

u/Rustacean789 Mar 02 '23

thank you for example

3

u/MindStudio Mar 02 '23

https://medium.com/flutter-community/how-to-call-a-rust-function-from-dart-using-ffi-f48f3ea3af2c

An article about writing a library in rust and using it in dart using FFI.

1

u/Rustacean789 Mar 02 '23

this article helped me a lot , thank you

2

u/svprdga Mar 02 '23

Why would you want to writte the business logic in Rust? In my opinion, you would need a very good reason, otherwise it doesn't make sense.

1

u/Rustacean789 Mar 03 '23

I need the program to work as fast as possible and the program will read pdf

2

u/svprdga Mar 03 '23

Why do you need to work as fast as possible?

1

u/NoLet658 Oct 23 '24

idk maybe deadlines?

1

u/[deleted] Nov 22 '24

Faster apps are better than slower apps?

1

u/svprdga Nov 22 '24

Dart is fast enough for the majority of the cases. If not, you delegate to the native language.

2

u/oravecz Mar 02 '23

A library on the other hand - yes, maybe. If it was already written in Rust, absolutely. If not, why aren’t I writing it in Dart?

1

u/Cautiousart Feb 28 '25

Rust has excellent support for describing your thinking abstractions more accurately but without the hassle of purely functional languages. For example, interfaces (in other languages) require one to think about external requirements of a class, so we're no longer reasoning locally about a concept. In rust, you can encode your abstraction exactly with enums where a common interface isn't enforced and the variations can be true to their nature. Then, later, you can think about how those variations make sense in an external context by implementing From<> or Into<>. In any case, in rust, your reasoning is more properly located in your codebase, which is very good, IMO, for writing business logic.

3

u/temeddix Jul 11 '23

This package smoothly integrates Rust into your project without hassle

https://pub.dev/packages/rust_in_flutter

2

u/another-noob Mar 02 '23

I'm no expert but here's a great local database (isar) written in rust if you'd like to check out another project

https://github.com/isar/isar

2

u/jarlaxle46 Mar 02 '23

Flutter rust bridge. Sorry on mobile so don't have a link handy. Google it

1

u/_____case Oct 11 '24

Toyota's new infotainment system is built with a combination of Rust and Flutter.