getDeviceDetails function

Future<List<String>> getDeviceDetails()

Implementation

Future<List<String>> getDeviceDetails() async {
  String deviceName = "";
  String deviceVersion = "";
  String identifier = "";
  final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin();
  try {
    if (Platform.isAndroid) {
      var build = await deviceInfoPlugin.androidInfo;
      deviceName = build.model!;
      deviceVersion = build.version.release!;
      identifier = formatStringToUUID(build.androidId!); //UUID for Android
    } else if (Platform.isIOS) {
      var data = await deviceInfoPlugin.iosInfo;
      deviceName = data.name!;
      deviceVersion = data.systemVersion!;
      identifier = data.identifierForVendor!; //UUID for iOS
    }
  } on PlatformException {
    print('Failed to get platform version');
  }

//if (!mounted) return;
  return [deviceName, deviceVersion, identifier];
}