Skip to content

Instantly share code, notes, and snippets.

@leonardopinho
Created March 30, 2020 17:47
Show Gist options
  • Save leonardopinho/35b1912974f409380c06585576b7cc77 to your computer and use it in GitHub Desktop.
Save leonardopinho/35b1912974f409380c06585576b7cc77 to your computer and use it in GitHub Desktop.
import 'dart:io';
import 'package:device_info/device_info.dart';
static Future<String> getDeviceId() async {
String result;
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
result = androidInfo.id;
}
if (Platform.isIOS) {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
result = iosInfo.identifierForVendor;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment