getId2 method

Future<String> getId2()

Implementation

Future<String> getId2() async {
  var deviceData = <String, dynamic>{};
  String id = "";

  // print("reaa");
  // Helper().readAll();
  try {
    if (kIsWeb) {
      // deviceData = _readWebBrowserInfo(await deviceInfoPlugin.webBrowserInfo);
    } else {
      if (Platform.isAndroid) {
        String androidId;
        // Platform messages may fail, so we use a try/catch PlatformException.
        // We also handle the message potentially returning null.

        deviceData =
            _readAndroidBuildData(await deviceInfoPlugin.androidInfo);

        id = await _androidIdPlugin.getId() ?? 'Unknown ID';
        // id = "Dana";
      } else if (Platform.isIOS) {
        deviceData = _readIosDeviceInfo(await deviceInfoPlugin.iosInfo);
      } else if (Platform.isLinux) {
      } else if (Platform.isMacOS) {
      } else if (Platform.isWindows) {}
    }
  } on PlatformException {
    deviceData = <String, dynamic>{
      'Error:': 'Failed to get platform version.'
    };
  }
  if (Platform.isAndroid) {
    // print("id Device ${deviceData["id"]}");
    // print("id Device2 ${deviceData["androidId"]}");
    // id = deviceData["id"];
  } else if (Platform.isIOS) {
    id = deviceData["identifierForVendor"];
  }

  return id;
}