xxxxxxxxxx
import 'package:platform_device_id/platform_device_id.dart';
String deviceId = await PlatformDeviceId.getDeviceId;
xxxxxxxxxx
import 'package:device_info/device_info.dart';
Future<String?> getDeviceId() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
String? deviceId;
if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
deviceId = androidInfo.androidId;
} else if (Platform.isIOS) {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
deviceId = iosInfo.identifierForVendor;
}
return deviceId;
}