This 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 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.
The followings are the libraries and technologies that are used in this sample.
implement
/interface
modules.ui
directory.domain
, data
, and presentaiton
directories. The data layer is completely empty and just created to show how wire up these layers.bridge-ffi
directory.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.Enjoy!
I can mention the following for my choice.
It 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.
You need to install:
xcode
if you're on a macsdk
, and Android ndk
flatbuffer
rust
's rustup
, cargo
, cargo-make
and the targetsflutter
To build and run tests just use standard cargo
commands.
cargo test
Before making the artifacts from rust code first run
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
rustup target add aarch64-apple-ios x86_64-apple-ios
cargo install cargo-make
Then build the shared libraries by
cargo make
To run the flutter app
cd ui && flutter run
If you're familiar with Nix, you just need to install:
xcode
if you're on a macsdk
flutter
and Nix will take care of the rest by
nix-shell shell.nix
$ cargo test
$ cargo make
It'll build the shared libraries for Android and iOS. Then you can exit
the shell, and continue on flutter:
cd ui && flutter run
Please feel free to fill an issue to ask questions or report issues. Also creating PRs are welcomed.