{"id":18026554,"url":"https://github.com/hadilq/rust-flutter-reactive","last_synced_at":"2025-03-27T01:31:17.306Z","repository":{"id":49878292,"uuid":"301089599","full_name":"hadilq/rust-flutter-reactive","owner":"hadilq","description":"This is a sample app to improve consistency over Mobile App Development.","archived":false,"fork":false,"pushed_at":"2021-12-29T22:53:41.000Z","size":128,"stargazers_count":37,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-22T21:06:24.987Z","etag":null,"topics":["clean-architecture","dart","ffi","flatbuffers","flutter","mobile","native","reactive","redux","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hadilq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-04T09:31:51.000Z","updated_at":"2025-03-06T01:05:58.000Z","dependencies_parsed_at":"2022-08-19T07:51:23.159Z","dependency_job_id":null,"html_url":"https://github.com/hadilq/rust-flutter-reactive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadilq%2Frust-flutter-reactive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadilq%2Frust-flutter-reactive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadilq%2Frust-flutter-reactive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadilq%2Frust-flutter-reactive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hadilq","download_url":"https://codeload.github.com/hadilq/rust-flutter-reactive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245764657,"owners_count":20668456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clean-architecture","dart","ffi","flatbuffers","flutter","mobile","native","reactive","redux","rust"],"created_at":"2024-10-30T08:07:18.909Z","updated_at":"2025-03-27T01:31:14.767Z","avatar_url":"https://github.com/hadilq.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nRust Flutter Reactive\n---\nThis is a sample app to improve consistency over Mobile App Development. You can find more explanation below. By the way, I started playing with [fluterust](https://github.com/shekohex/flutterust) sample, but in the end, by reorganize its structure and architecture, and also don't rely on FFI code generations, come up with this solution, so part of the code here is just a copy of that sample.\n\nTechnologies\n---\nThe followings are the libraries and technologies that are used in this sample.\n - Rust as the main part of the app. Tried to create it as scalable as possible.\n - Dependency Injection.\n - Applying Dependency Inversion Principle on module level, where you can find `implement`/`interface` modules.\n - Flutter as the ui framework. You can find the flutter project in `ui` directory.\n - Clean Architecture as you can find the domain, data, and presentation layers in `domain`, `data`, and `presentaiton` directories. The data layer is completely empty and just created to show how wire up these layers.\n - FFI as Foreign function interface and bridge between Rust and Dart code in Flutter. You can find this bridge in `bridge-ffi` directory.\n - Flatbuffers as the serializer of the bridge. Thanks to fast and scalable serialization of Flatbuffers, this project can be easily plugged out of Flutter and attached to other ui frameworks if exists! Also it make this project scalable without touching the FFI bridge code(Just in case of error or memory leak you may need to touch it). Flatbuffers generates the `state` and `action`, where both of them are tree structures, so each developer can work on their branches without conflicting with other developers. Scalability is in the heart of this sample.\n - Redux as the architectural pattern of presentation layer. It designed to be fractal(The tree structure that mentioned before), so it's highly scalable among large number of developers.\n\nEnjoy!\n\nWhy Rust?\n---\nI can mention the following for my choice.\n - Performance for sure.\n - Strong typing up to constant generics, which means scalability. This one is highly important in my mind, as it can makes you 10x developer by avoiding future bugs and inconsistencies. By up to constant generics, I mean its type system is stronger than Java, Kotlin, Swift, etc. so the code base will be more scalable in Rust.\n - Super fast compiling when you re-run the tests.\n - Compiler messages are more like Stackoverflow posts. Most of them guide you to the correct solution.\n - The same as Dart it makes the code independent of platform.\n \nWhy Flutter?\n---\nIt makes the code independent of the platform. As an Android developer, we face solving problems of Android fragmentation, much frequently than it should be. Add to these inconsistencies, every company deals at least with two sets of developers, Android and iOS developers, for the same problem. If you have the same use-case/validation in backend and frontend you have more than two sets of developers for the same problem. This inconsistencies in worst cases produce bugs. But even when there is no bug, they make users angry why the same feature is working differently in two platforms. By making your code independent of platform you can make it consistent. However, everything is a trade-off. The price you pay for consistency among all platforms is the size of the app. For instance, the size of the `app-debug.apk` file of this sample is 38M, which I think worth it.\n\nRun/Test\n---\nYou need to install:\n + `xcode` if you're on a mac\n + Android Studio, Android `sdk`, and Android `ndk`\n + `flatbuffer`\n + `rust`'s `rustup`, `cargo`, `cargo-make` and the targets\n + `flutter`\n\nTo build and run tests just use standard `cargo` commands.\n```bash\ncargo test\n```\nBefore making the artifacts from rust code first run\n```bash\nrustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android\nrustup target add aarch64-apple-ios x86_64-apple-ios\ncargo install cargo-make\n```\nThen build the shared libraries by\n```bash\ncargo make\n```\nTo run the flutter app\n```bash\ncd ui \u0026\u0026 flutter run\n```\n\n### Nix\n\nIf you're familiar with [Nix](https://nixos.org/manual/nixpkgs/stable/), you just need to install:\n + `xcode` if you're on a mac\n + Android Studio, and Android `sdk`\n + `flutter`\n\nand Nix will take care of the rest by\n```bash\nnix-shell shell.nix\n$ cargo test\n$ cargo make\n```\nIt'll build the shared libraries for Android and iOS. Then you can `exit` the shell, and continue on flutter:\n```bash\ncd ui \u0026\u0026 flutter run\n```\n\nQuestions/Problems\n---\nPlease feel free to fill an issue to ask questions or report issues. Also creating PRs are welcomed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadilq%2Frust-flutter-reactive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhadilq%2Frust-flutter-reactive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadilq%2Frust-flutter-reactive/lists"}