flutter_config 2.0.2 copy "flutter_config: ^2.0.2" to clipboard
flutter_config: ^2.0.2 copied to clipboard

Plugin that exposes environment variables to your Dart code in Flutter as well as to your native code in iOS and Android. Bring some 12 factor love to your Flutter apps

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_config/flutter_config.dart';

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

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var allValues = <Widget>[];

    FlutterConfig.variables.forEach((k, v) {
      allValues.add(Text('$k: $v'));
    });

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(children: [
          ...allValues,
          SizedBox(
            height: 20,
          ),
          Text('Values of fabric Id: ${FlutterConfig.get('FABRIC_ID')}')
        ])),
      ),
    );
  }
}
203
likes
160
points
22.5k
downloads

Publisher

verified publisherbyneapp.com

Weekly Downloads

Plugin that exposes environment variables to your Dart code in Flutter as well as to your native code in iOS and Android. Bring some 12 factor love to your Flutter apps

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on flutter_config