Flutter Template
This template provides starting point for Flutter hybrid app, following Klika quality guidelines, with implemented authentication following OAuth2 standard.
Setup
Dependencies
- Latest Flutter SDK
- Ruby + overcommit gem
scripts/setup
This script will:
- Setup overcommit hooks
Configuration
To get basic idea about configuration approach read 12factor.
Configuration is achieved using "flavors" and is stored in lib/config.dart. By default, application is started in production
flavor. To run in development
, start with flutter run -t lib/main-dev.dart
. Platform flavors can be used too (flutter run --flavor dev -t lib/main-dev.dart
). This project defines dev
and prod
platform flavors.
Running development:
flutter run --flavor dev -t lib/main-dev.dart
Running production:
flutter run --flavor prod
Getting started
Use Klika quality guidelines for general development references.
Flutter/Dart styleguides
This project is following official Flutter codestyle, which is also enforced by lint tool. More guidelines are available in official documentation.
New feature
Use GitFlow development workflow with tests included.
Pull request quality gates
- no conflicts with target branch
- pass CI tests
- code review approval
Tools
Networking with Dio
Networking is implemented using dio, to provide HTTP client as well as interceptors, combined with json_serializable for generating utilities for transforming classes to and from JSON.
Local DB with Hive
Hive is used for local database.
Dependency injection and state management with Provider
We are using provider library for dependency injection, as well as state management.
Quality gates
This project will run static code analyser on every commit and full test suite on git push.
Static code analyser
This template is using dartanalyzer with pedantic package for static code analysis. All offenses are automatically tracked and prevented on every commit. This feature is handled by Overcommit git hook manager.
Testing
We are using flutter_test library with mockito for mocking and http_mock_adapter for mocking HTTP requests.
Continuous Integration
AppCenter is recommended for CI. Since Flutter is not supported by AppCenter, check out official scripts for more info on setup.