unique_identifier 0.2.0-dev.1 copy "unique_identifier: ^0.2.0-dev.1" to clipboard
unique_identifier: ^0.2.0-dev.1 copied to clipboard

outdated

A new Flutter plugin for fetching the unique identifier from android and ios.

example/lib/main.dart

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

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

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

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

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

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

  Future<void> initUniqueIdentifierState() async {
    String identifier;
    try {
      identifier = await UniqueIdentifier.serial;
    } on PlatformException {
      identifier = 'Failed to get Unique Identifier';
    }

    if (!mounted) return;

    setState(() {
      _identifier = identifier;
    });
  }

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

Publisher

verified publisheraltercode.xyz

A new Flutter plugin for fetching the unique identifier from android and ios.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on unique_identifier