Skip to content

tstefanovska/flutter-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Template

Flutter template project - A simple TODO list app

Run Configurations

In addition to the Flutter's build modes (debug, profile, release), the project has 4 flavours/schemas for defining environments:

  • mock - mock environment that uses mock values. Launches main_mock.dart
  • dev - development environment that targets a development server. Launches main_dev.dart
  • staging - staging environment that targets a staging server. Launches main_staging.dart
  • production - production environment that targets a production server. Launches main_production.dart

To run the app use the following command:

flutter run --flavor dev -t lib/main_dev.dart

or edit run configurations in Android Studio:

  • Go to EditConfigurations...
  • Enter configuration name: DEV, STAGE, PROD
  • Enter dart entry point: main_dev.dart, main_staging.dart, main_production.dart
  • Enter additional run args: --flavor=dev, --flavor=staging, --flavor=production
  • Enter build flavor: dev, staging, production

See flavor_config.dart for environment specific config.

For adding an additional Flutter flavours see the official documentation and this blog post.

Data Management

Alt text

This is the main entry point for accessing and manipulating tasks data. The rest of the app should not invoke tasks' endpoints directly or query cached data. All tasks operations should go through this service.

Implementations:

Abstraction over the API communication that defines (all) endpoints. This templates uses Chopper, an http client generator, to make network requests.

JSON and Serialization

JSON models are serialized using a code generation library.

For one time code generation run this command in terminal: flutter pub run build_runner build

For subsequent code generations with conflicting outputs: flutter pub run build_runner build --delete-conflicting-outputs

For more information and generating code continuously see the documentation.

Declarative UI

Flutter is declarative framework. This means that Flutter builds its user interface to reflect the current state of the app.

High level diagram

This template does not yet use a state management tool. Instead, each app service has an updates Stream that clients can subscribe to and receive state updates. It's up to you to use a tool of your choice, or don't use one at all. See TasksRepository#taskEventUpdatesStream and TasksRepository#taskGroupUpdatesStream in TasksRepository

Dependency Management

Dependencies are managed in the service_locator.dart file. This sample uses GetIt, a lightweight service locator.

Tests

The test package contains unit tests for the TasksDataSource and TasksRepository:

About

A Flutter template project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 98.3%
  • Ruby 1.2%
  • Other 0.5%