Created
March 30, 2020 17:47
-
-
Save leonardopinho/35b1912974f409380c06585576b7cc77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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