getDeviceId property
Information derived from android
-androidId
or ios
-identifierForVendor
Implementation
static Future<String?> get getDeviceId async {
String? deviceId;
try {
if (kIsWeb) {
deviceId = await PlatformDeviceIdPlatform.instance.getDeviceId();
} else if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
deviceId = androidInfo.androidId;
} else if (Platform.isIOS) {
IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
deviceId = iosInfo.identifierForVendor;
} else {
deviceId = await PlatformDeviceIdPlatform.instance.getDeviceId();
}
} on PlatformException {
deviceId = '';
}
return deviceId;
}