2022-03-11 21:38:52 +02:00
|
|
|
import 'package:flutter_udid/flutter_udid.dart';
|
2022-03-11 22:38:15 +02:00
|
|
|
import 'dart:io' show Platform;
|
2022-02-03 18:06:44 +02:00
|
|
|
|
2022-06-25 20:46:51 +02:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
|
|
|
final deviceInfoServiceProvider = Provider((_) => DeviceInfoService());
|
|
|
|
|
2022-02-03 18:06:44 +02:00
|
|
|
class DeviceInfoService {
|
|
|
|
Future<Map<String, dynamic>> getDeviceInfo() async {
|
|
|
|
// Get device info
|
2022-06-23 06:14:14 +02:00
|
|
|
var deviceId = await FlutterUdid.consistentUdid;
|
|
|
|
var deviceType = "";
|
2022-02-03 18:06:44 +02:00
|
|
|
|
2022-03-11 22:38:15 +02:00
|
|
|
if (Platform.isAndroid) {
|
2022-02-03 18:06:44 +02:00
|
|
|
deviceType = "ANDROID";
|
2022-03-11 22:38:15 +02:00
|
|
|
} else if (Platform.isIOS) {
|
2022-02-03 18:06:44 +02:00
|
|
|
deviceType = "IOS";
|
|
|
|
}
|
|
|
|
|
|
|
|
return {"deviceId": deviceId, "deviceType": deviceType};
|
|
|
|
}
|
|
|
|
}
|