This is the mobile app for the DEalog project.
- Flutter 2.8.1
- Dart 2.15.1
- Xcode 13.2.1
- Android SDK 31.0.0
In order to support the development you need to first setup your development environment appropriately.
Please see the Flutter documentation on how to do so.
In order to be able to run the iOS version you need to develop on a macOS system.
Android works on every major platform.
Flutter has broad support on various platforms. The easiest solution is to use Android Studio with the Flutter plugin.
Alternatively you can use the VS Code Flutter plugin. Note that you need to install the Android SDK manually then.
For json serialization we are using json_serializable.
- One-time code generation
flutter pub run build_runner build --delete-conflicting-outputs
- Generating code continuously
flutter pub run build_runner watch
For translation and localization we use the Easy Localization plugin.
Regenerate configuration:
flutter pub run easy_localization:generate -S ./assets/translations
Regenerate key classes:
flutter pub run easy_localization:generate -S ./assets/translations -f keys -o locale_keys.g.dart
The application supports dark mode via Flutter's embedded support.
To simplify the generation of app icons for iOS and Android, we use the Flutter Launcher Icons plugin.
If the app icons are changed within the asset directory, you have to run
flutter pub run flutter_launcher_icons:main
to update the icons in the iOS and Android project.
We use Platform Widgets to simplify the codebase regading the platform specific styles (Material for Android devices and Cupertino for iOS devices).
We use get_it as a service locator (a simple dependency injection mechanism) to define how to create objects with all their dependencies. The definitions can be found in the lib/locator.dart
source file.
Testing is done on all 3 levels that are supported by the flutter framework
For unit tests we use mockito to mock dynamic data. Complex functions/computations are tested here. These tests are executed within the framework itself and are very fast.
Widget tests cover the UI behavior for a dedicated widget. It allows us to develop test driven. This tests are executed within the framework itself and are very fast.
Integration tests allows to test a whole app, so the interaction between multiple widgets. The integration tests are executed in a platform emulator e.g. Android(AVD) so they need more time because the test needs a started emulator and needs to flash the app on the virtual device.
- Unit and widget tests will be executed by the following command within the app root directory.
flutter test
- Integration tests will be executed by the following command within the app root directory. This example tests the main app, anyway there could be more Integration tests to test certain widget groupings
flutter test --dart-define=FLUTTER_TEST_ENVIRONMENT=int integration_test/app_test.dart
- When testing a widget that is using
StreamingSharedPreferences
make sure the underlayingShared.Preferences
are initially mocked withSharedPreferences.setMockInitialValues
.
For extensible logging we use fimber package.
- Android App Bundle:
flutter build appbundle
The Bitrise workflows can be executed locally. E. g. nstall the bitrise CLI executable and run:
bitrise run <workflow name>
To provide the secrets for the build, create a file .bitrise.secrets.yml
with the following content:
envs:
- BITRISEIO_ANDROID_KEYSTORE_URL: file://<path to keystore>
- BITRISEIO_ANDROID_KEYSTORE_ALIAS: key
- BITRISEIO_ANDROID_KEYSTORE_PASSWORD: <keystore password>
- BITRISEIO_BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL: file://<path to google play service account
- SLACK_WEBHOOK_URL: <stlack webhook url>
- Increase the project version within the pubspec.yaml
- Commit and push the repo with the updated project version
- Create a new tag for the new project version