getDeviceModel function

Future<String?> getDeviceModel()

Implementation

Future<String?> getDeviceModel() async {
  BaseDeviceInfo deviceInfo = await getDeviceInfo();
  if (Platform.isAndroid) {
    AndroidDeviceInfo androidDeviceInfo =
        AndroidDeviceInfo.fromMap(deviceInfo.data);
    return '${androidDeviceInfo.brand} ${androidDeviceInfo.model}';
  }
  if (Platform.isIOS) {
    IosDeviceInfo iosDeviceInfo = IosDeviceInfo.fromMap(deviceInfo.data);
    return iosDeviceInfo.utsname.machine;
  }
  return null;
}