flutter_native_config 1.0.0 copy "flutter_native_config: ^1.0.0" to clipboard
flutter_native_config: ^1.0.0 copied to clipboard

A plugin to access native configuration for both Android and iOS from Flutter.

flutter_native_config #

A plugin to access native configuration for both Android and iOS from Flutter.

For some third party integrations, for example Google and Facebook, the API keys are usually stored in the native realm -- namely AndroidManifest.xml and Info.plist -- and there's no way to access these values from Flutter. Until now, that it :)

This plugin allows you to access those values directly from Flutter so you don't have to include then in Dart code in addition to the native realm.

Usage #

Import package:flutter_native_config/flutter_native_config.dart, and use the public function FlutterNativeConfig.getConfig() to retrieve a value from both Android and iOS. Because most of the time the key names are different for these two platforms, the function accepts a separate key for each platform.

Example:

import 'package:flutter_native_config/flutter_native_config.dart';

Future<String> get appId {
  return FlutterNativeConfig.getConfig<String>(
    android: 'version_name',
    ios: 'CFBundleName',
  );
}

Future<String> get appVersion {
  return FlutterNativeConfig.getConfig<String>(
    android: 'version_code',
    ios: 'CFBundleShortVersionString',
  );
}

Future.wait([appId, appVersion]).then((result) {
  print('App: ${result[0]} v${result[1]}');
});

Issues #

For reporting bugs, incompatibilities, or feature requests, please submit a new issue.

Contributing #

If you wish to contribute a fix or a new feature, please submit a pr.

License #

This plugin is released under the MIT license.

2
likes
40
pub points
33%
popularity

Publisher

unverified uploader

A plugin to access native configuration for both Android and iOS from Flutter.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_native_config