Untitled

 avatar
unknown
dart
2 years ago
498 B
6
Indexable
class DeviceInfoHelper {
  DeviceInfoHelper._();

  static var shared = DeviceInfoHelper._();

  Future getId() async {
    var deviceInfo = DeviceInfoPlugin();
    if (Platform.isIOS) {
      IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
      return iosDeviceInfo.identifierForVendor; // unique ID on iOS
    } else if (Platform.isAndroid) {
      AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo;
      return androidDeviceInfo.id; // unique ID on Android
    }
  }
}
Editor is loading...