android_metadata 0.2.1
android_metadata: ^0.2.1 copied to clipboard

A flutter plugin to get metadata defined in AndroidManifest.xml.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:android_metadata/android_metadata.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Map<String, String> _metadata = Map();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    Map<String, String> metadata = Map();

    try {
      metadata = await AndroidMetadata.metaDataAsMap;
    } on PlatformException {
      ;
    }


    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _metadata = metadata;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Metadata: $_metadata\n'),
        ),
      ),
    );
  }
}
3
likes
90
pub points
73%
popularity

Publisher

danieldai.com

A flutter plugin to get metadata defined in AndroidManifest.xml.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on android_metadata