Skip to content

Instantly share code, notes, and snippets.

@shishirthedev
Created July 24, 2019 10:43
Show Gist options
  • Save shishirthedev/9241c01582425b8566394f5eaefa1845 to your computer and use it in GitHub Desktop.
Save shishirthedev/9241c01582425b8566394f5eaefa1845 to your computer and use it in GitHub Desktop.
//// Using Device Info Package................
Future<String> _getId() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Theme.of(context).platform == TargetPlatform.iOS) {
IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
} else {
AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo;
return androidDeviceInfo.androidId; // unique ID on Android
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment