Skip to content
pubscout

flavor

2.0.0, released 5 years ago by stefandevo.dev

Configure environment-specific settings and display visual flavor banners.

WASM-readyRepository archived
$ flutter pub add flavor
Source repository

What it does

Allows defining separate main entry points for different development environments like dev, beta, and production. Stores environment-specific properties such as API keys and URLs, and optionally displays a visual banner on the app.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to easily manage different API endpoints and configurations for development, staging, and production.
  • You want to display a visual overlay banner on non-production builds.

Skip it when

  • You need native-level bundle ID and asset switching (use a tool like flutter_flavorizr instead).
  • You require complex state management solutions.

Strengths

  • Simple setup with Dart-based main methods.
  • Built-in support for environment properties like API URLs and keys.
  • Optional visual flavor banner display.

Weaknesses

  • Does not configure native-level Android and iOS build flavors by itself.
  • Limited to predefined and custom basic key-value properties.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Create separate main entry point files for each environment (e.g., main_dev.dart, main_prod.dart) and initialize Flavor.create.

Flavor.create(
  Environment.dev,
  color: Colors.green,
  name: 'PREVIEW',
  properties: {
    Keys.apiUrl: 'https://api.dev.company.com',
  },
);
setupApp();

Alternatives

Packages that do the same job and could replace flavor.