flutter_udid 1.2.0 flutter_udid: ^1.2.0 copied to clipboard
Plugin to retrieve a persistent UDID accross reinstalls on iOS and Android
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_udid/flutter_udid.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _udid = 'Unknown';
@override
void initState() {
super.initState();
initPlatformState();
}
Future<void> initPlatformState() async {
String udid;
try {
udid = await FlutterUdid.udid;
} on PlatformException {
udid = 'Failed to get UDID.';
}
if (!mounted) return;
setState(() {
_udid = udid;
});
}
@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: $_udid\n'),
),
),
);
}
}