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
AppDependencies
for some simple dependency injection using a Provider. - See
TestDepdendencies
for injection of test dependencies. - See
result.dart
for functional handling of errors. - See
json_decoder.dart
for simple json decoding (careful it can throw exception). - See
http.dart
for exception free API integrations including safe json parsing. - See
location_search_api.dart
for a usage example of all the above. - See
location_search_page_test.dart
for an example test with API integration. - See
main.dart
for the main app scaffolding. - See
app_pages
for 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 Devices
view. - Select the emulator from the device list next to the run configuration.
- Run
main.dart
- Start the
iOS Simulator
app - 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.