Skip to content
pubscout

flavor_getter

0.0.4, released 2 years ago by thepinkchannel.com

Plugin to read current app flavor from native code

WASM-ready
$ flutter pub add flavor_getter
Source repository

What it does

Flavor Getter allows Flutter code to query the flavor (variant) the app is running in. It exposes a simple async method that returns a string representing the flavor set in the native build configuration.

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

Use it when

  • When you need to branch logic based on the current flavor
  • During debugging or logging to verify the active flavor
  • When building a single codebase for multiple environments (dev, prod, staging)

Skip it when

  • When your project does not use flavors
  • When you prefer to hardcode environment values instead of querying at runtime

Strengths

  • Simple API, no code generation
  • Supports both Android and iOS
  • Requires minimal dependencies

Weaknesses

  • Only works on Android and iOS
  • Needs native build configuration steps
  • No support for web or desktop

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
1

Requires adding a FLAVOR build setting and Info.plist entry on iOS, and defining productFlavors and buildFeatures in Android Gradle. No permissions or build_runner needed.

import 'package:flavor_getter/flavor_getter.dart';

void main() async {
  String flavor = await FlavorGetter().getFlavor();
  print('Running in flavor: $flavor');
}

Alternatives

Packages that do the same job and could replace flavor_getter.

  • flutter_flavorizr

    A utility to easily create and configure application flavors in Flutter.

  • dart_spawner

    Runs Dart scripts, files, or URIs inside a new Isolate of the current Dart VM.

  • puby

    Run Dart and Flutter commands across multiple projects in the current directory.

  • flutter_flavor

    Configure and define dynamic variables and UI banners for different app flavors.

Works with

Packages commonly used together with flavor_getter: ones it builds on, ones built on it, and its own family.