This project is a starting point for a Flutter application.
* In [Intellij](https://www.jetbrains.com/idea/) or [Android Studio](https://developer.android.com/studio/) (recommended), install the flutter and dart (dependency of flutter) plugins
* Set up Android SDK:
* Install via IDE in a folder of your choice (you probably want it not be to installed as superuser)
* Set the `ANDROID_HOME` variable so that IDE can detect it automatically
```
export ANDROID_HOME="$HOME/.android_sdk"
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
```
* Set up [flutter SDK](https://flutter.dev/docs/get-started/install), you probably want this also on your `PATH` like `ANDROID_HOME`
```
export PATH="$HOME/.flutter_sdk/bin/:$PATH"
```
* In the IDE, set the correct SDK paths (e.g. to flutter, dart, Android)
Start by installing dependencies and generating entities!
## Dependencies
* Run `flutter packages pub get` in project root folder to get dependencies or open the `pubspec.yaml` and click on the buttons provided by the IDE plugins
## JSON Serialization Files
Generate required entities by using these commands:
* Build once: `flutter packages pub run build_runner build --delete-conflicting-outputs`
* File watcher: `flutter packages pub run build_runner watch`
## Architecture
* Views have models
* Model classes use services
* Service classes use data repositories
* Data repositories use the `Api` class
Resulting data workflow: `USER -> view -> model -> service -> repository -> API`.
* *NEVER* use services in views (except for `NavigationService` or `DialogService` if needed)! Create a model function instead. The UI is then fully decoupled from any business logic.
* *DON'T* swallow exceptions with `catch (_/e)`
* *ONLY* handle `ServiceException`! Other exceptions are serious errors and should therefore result in an error (or get caught by a global catcher)
* *ONLY* handle `ServiceException` in *model* classes to show the user a result
* *ALWAYS* use the `DialogService` (also possible from within a service/model) and *DON'T* create separate dialogs
* *ALWAYS* use the `NavigationService` for navigation and *NOT*`Navigation.of(...)`
## Build & Release
### Release with Fastlane
You need [fastlane](https://fastlane.tools/) installed locally. Look at the initial setup on how to do that.
Fastlane is used to manage the app store presentation and automatic uploading to the Play Store and
to the App Store. With fastlane you can do common tasks in a collaborative way, e.g. publishing
to or adapting the texts for the different stores from the commandline.
Before using fastlane you need to properly setup signing, otherwise building will not work.
Initial setup should already be done but this link helps for initial project setup: