r/flutterhelp • u/Rustacean789 • 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
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
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
1
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
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
2
1
u/_____case Oct 11 '24
Toyota's new infotainment system is built with a combination of Rust and Flutter.
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.