/flutter_environments

A Flutter app demonstrating multiple environment configurations.

Primary LanguageDart

flutter_environments

A Flutter app demonstrating multiple environment configurations. It's the stock flutter counter app with a few environment-specific variables (colours, strings, etc). There's also a test to validate that environments are working correctly.

How it works

  • environment configuration files are found in lib/config
  • running lib/main.dart uses the Development environment by default
  • run lib/config/{environment}.dart to build for the desired environment
  • the app's constructor receives an Env instance
  • Env.value.{attribute} can also be called statically from anywhere within the application
  • Env.value.name returns the environment's name; ie "Staging"
  • tests have their own environment which is passed to the app's constructor from within the test

Getting Started

  • clone the project
  • run $ flutter packages get
  • experiment with the following commands...
Defaults to Development environment

$ flutter run lib/main.dart

development

Run Staging environment

$ flutter run lib/config/staging.dart

development

Build for Production environment

$ flutter build apk lib/config/production.dart

development

Run the tests

$ flutter test test/widget_test.dart