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

outdated

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')}')
        ])),
      ),
    );
  }
}
204
likes
0
points
21.6k
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

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_config