Skip to content

A flutter plugin which will help you to get metadata values defined in AndroidManifest.xml (Android) or info.plist (iOS).

License

Notifications You must be signed in to change notification settings

shivbo96/platform_metadata

Repository files navigation

Pub

platform_metadata

A flutter plugin which will help you to get metadata values defined in AndroidManifest.xml (Android) or info.plist (iOS).

Created by Shivam Mishra @shivbo96

Buy Me A Coffee

Usage

Use this package as a library

  1. Depend on it Add this to your package's pubspec.yaml file:
dependencies:
  platform_metadata: <VERSION>
  1. Install it You can install packages from the command line: with Flutter:
$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

  1. Import it Now in your Dart code, you can use:
import 'package:platform_metadata/platform_metadata.dart';

Usage

place inside your android manifest file

<meta-data android:name="meta_key" android:value=" meta_value from android " />

place inside your iOS info.plist

<key>meta_key</key>
<string> meta_value from ios </string>
Future<void> getMetaData() async {
  String metaDataValue;
  try {
    metaDataValue = await PlatformMetadata.getMetaDataValue('meta_key') ?? '';
  } on PlatformException {
    metaDataValue = 'Failed to get metaDataValue.';
  }
  if (!mounted) return;

  setState(() {
    _metaDataValue = metaDataValue;
  });
}

for example refer to example/lib/main.dart

screenshots

More information

Pub package Flutter documentation.

About

A flutter plugin which will help you to get metadata values defined in AndroidManifest.xml (Android) or info.plist (iOS).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published