installer_info 0.7.0 copy "installer_info: ^0.7.0" to clipboard
installer_info: ^0.7.0 copied to clipboard

Returns information about the method used to install your app.

example/lib/main.dart

import 'dart:async';

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

void main() {
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  InstallerInfo? installerInfo;
  String? error;

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

  Future<void> initPlatformState() async {
    InstallerInfo? installerInfo;
    try {
      installerInfo = await getInstallerInfo();
    } on PlatformException catch (e) {
      setState(() => error = e.message);
    }

    if (!mounted) return;

    setState(() => this.installerInfo = installerInfo);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Installer Info'),
        ),
        body: Center(
          child: error != null
              ? Text(error!, textAlign: TextAlign.center)
              : Text(
                  'Installed by:\n${installerInfo?.installer}\n${installerInfo?.installerName}',
                  textAlign: TextAlign.center,
                ),
        ),
      ),
    );
  }
}
12
likes
160
points
458
downloads

Publisher

verified publishercaiopo.com

Weekly Downloads

Returns information about the method used to install your app.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on installer_info