Skip to content
pubscout

flutter_config

2.0.2, released 3 years ago by byneapp.com

Loads .env files and exposes variables to Dart, iOS and Android code.

WASM-ready
$ flutter pub add flutter_config
Source repository

What it does

Reads a .env file at app startup and makes each key/value pair accessible via FlutterConfig.get. Provides a test helper to inject values without a real .env file.

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

Use it when

  • You need simple access to build‑time configuration values in Flutter code
  • You want the same variables available in native iOS/Android code
  • You prefer a lightweight plugin without code generation

Skip it when

  • You require encrypted or obfuscated secrets in the binary
  • You need a full‑featured configuration management system with remote overrides

Strengths

  • Very small API, easy to use
  • Works on both Dart and native platforms
  • Supports testing by injecting values

Weaknesses

  • Secrets are not protected – must not store sensitive data
  • Only reads .env files; no runtime updates

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Add the plugin, run FlutterConfig.loadEnvVariables() before runApp; iOS requires no extra steps, Android may need Gradle 4+

import 'package:flutter_config/flutter_config.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterConfig.loadEnvVariables();
  runApp(MyApp());
}

// later
var apiUrl = FlutterConfig.get('API_URL');

Alternatives

Packages that do the same job and could replace flutter_config.