This is a starter project for Flutter based mobile applications. Some of the code is useful for desktop apps too. This is an example of a simple mobile app with API integration and how to set it up with some dependency injection and predictable testing of API integrations.
- See
AppDependenciesfor some simple dependency injection using a Provider. - See
TestDepdendenciesfor injection of test dependencies. - See
result.dartfor functional handling of errors. - See
json_decoder.dartfor simple json decoding (careful it can throw exception). - See
http.dartfor exception free API integrations including safe json parsing. - See
location_search_api.dartfor a usage example of all the above. - See
location_search_page_test.dartfor an example test with API integration. - See
main.dartfor the main app scaffolding. - See
app_pagesfor the UI.
- Install Flutter
- Install Android Studio with Flutter and Dart plugins
- Install XCode for iOS dev
This checks formatting, runs tests and checks for dependency cycles
make check
- In Android Studio, setup an emulator in the
Device Manager. - Run it using the play button in
Device Manager - It switches to the
Running Devicesview. - Select the emulator from the device list next to the run configuration.
- Run
main.dart
- Start the
iOS Simulatorapp - Install and Run the iPhone Simulator of your choice.
- In Android Studio, select the simulator from the device list next to the run configuration.
- Run
main.dart
- Configure device for developer mode (see Android/iOS documentation for that)
- Connect to your computer
- Select in Android Studio's device list
- Run
main.dart
We use a line length of 100 characters, which is good enough to show two files side by side on a modern 27 inch
screen.
Line length can be set in Android Studio Preferences > Editor > Code Style > Dart.
If your prefer a different line length, feel free to update the Tasks.mk to your team's liking
and have developers configure their IDE as well.
Make sure your imports are relative only for files in the same folder, otherwise use package: imports.