Мой код: < /p>
Код: Выделить всё
Future _getDeviceId() async {
if (kIsWeb) return; // Prevents running on Web
try {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
setState(() {
deviceId = androidInfo.id;
});
debugPrint("Device ID (IMEI-like): $deviceId");
} catch (e) {
setState(() {
deviceId = 'Failed to fetch device ID';
});
debugPrint("Failed to fetch device ID: $e");
}
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... in-flutter
Мобильная версия