global_configuration 2.0.0 copy "global_configuration: ^2.0.0" to clipboard
global_configuration: ^2.0.0 copied to clipboard

A flutter package for managing different configurations and making them available everythere inside the app.

example/main.dart

import 'package:flutter/material.dart';
import 'package:global_configuration/global_configuration.dart';
import 'AppSettings.config.dart';
import 'DevSettings.config.dart';

void main() async {
  GlobalConfiguration().loadFromMap(appSettings).loadFromMap(devSettings);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp() {
    // Access configuration at constructor
    GlobalConfiguration cfg = new GlobalConfiguration();
    print("Key1 has value ${cfg.getString("key1")}");
    print("Key2 has value ${GlobalConfiguration().getString("key2")}");
    print("Key5 has value ${cfg.getString("key5")}, this should be null!");
  }

  @override
  Widget build(BuildContext context) {
    // Access configuration at build method
    GlobalConfiguration cfg = new GlobalConfiguration();
    print("Key3 has value ${cfg.getString("key3")}");
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Flutter'),
        ),
        body: Center(
          child: Text('Hello World'),
        ),
      ),
    );
  }
}
135
likes
130
pub points
97%
popularity

Publisher

unverified uploader

A flutter package for managing different configurations and making them available everythere inside the app.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on global_configuration