getDeviceId method
Implementation
Future<String> getDeviceId() async {
final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin();
try {
if (Platform.isAndroid) {
var build = await deviceInfoPlugin.androidInfo;
final identifier = build.androidId;
return identifier;
} else if (Platform.isIOS) {
var data = await deviceInfoPlugin.iosInfo;
final identifier = data.identifierForVendor; //
return identifier;
} else {
return 'unknown';
}
} on PlatformException {
print('Failed to get platform version');
return 'Failed to get platform version';
}
}