getDeviceName function
getDeviceName method this method will get device or model name of the device
Implementation
Future<String?> getDeviceName() async {
String? deviceName;
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
if (Platform.isAndroid) {
final AndroidDeviceInfo androidDeviceInfo = await deviceInfoPlugin.androidInfo;
deviceName = androidDeviceInfo.model;
} else if (Platform.isIOS) {
final IosDeviceInfo iosDeviceInfo = await deviceInfoPlugin.iosInfo;
deviceName = iosDeviceInfo.name;
}
return deviceName;
}