app_info 0.0.1 copy "app_info: ^0.0.1" to clipboard
app_info: ^0.0.1 copied to clipboard

AppInfo flutter plugin.

example/lib/main.dart

import 'dart:async';

import 'package:app_info/app_info.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

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

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

class _MyAppState extends State<MyApp> {
    String _platformVersion = 'Unknown';

    @override
    void initState() {
        print("init state ...");
        super.initState();
        initPlatformState();
    }

    Future<void> initPlatformState() async {
        String r;
        try {
            r = await AppInfo.platformVersion;
            r += "|" + await AppInfo.appId;
            r += "|" + await AppInfo.udid;
            r += "|" + await AppInfo.model;
            r += "|" + await AppInfo.appVerName;
            r += "|" + (await AppInfo.appVerCode).toString();
            r += "|" + await AppInfo.appChannel;
        } on PlatformException {
            r = 'Failed to get platform version.';
        }

        if (!mounted) return;

        setState(() {
            _platformVersion = r;
        });
    }

    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            home: Scaffold(
                appBar: AppBar(
                    title: const Text('Plugin example app'),
                ),
                body: Center(
                    child: Text('Running on: $_platformVersion\n'),
                ),
            ),
        );
    }
}
0
likes
20
pub points
51%
popularity

Publisher

unverified uploader

AppInfo flutter plugin.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on app_info