I have to get Android Device Name,
I got the IOS Device Data as Below.
DeviceInfoPlugin deviceInfo = await AppUtils.getDeviceDetails();
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
deviceModel = iosInfo.model!;
deviceName = iosInfo.name!;
deviceOS = "IOS";
osVersion = iosInfo.systemVersion!;
But How I can get Android Device Name? Can I have to use any Other Package? because in this package i can not find any option to get android device name.
CodePudding user response:
Use Device Info Plus Plugin maintain by Flutter Community and here is the code
var release, sdkInt, modelAndroid, manufacturer;
var systemName, versionIOS, name, modelIOS;
PackageInfo packageInfo = await PackageInfo.fromPlatform();
if(Platform.isAndroid){
var androidInfo = await DeviceInfoPlugin().androidInfo;
release = androidInfo.version.release;
sdkInt = androidInfo.version.sdkInt;
manufacturer = androidInfo.manufacturer;
modelAndroid = androidInfo.model;
} else if(Platform.isIOS){
var iosInfo = await DeviceInfoPlugin().iosInfo;
systemName = iosInfo.utsname.sysname;
versionIOS = iosInfo.systemVersion;
name = iosInfo.name;
}
var details = Platform.isAndroid ? "Android Release & SDK : $release - $sdkInt "
"\nAndroid Model : $manufacturer $modelAndroid" : "IOS System : $systemName"
"\nIOS Version : $versionIOS" "\nName : $name";
Here is the link : https://pub.dev/packages/device_info_plus
CodePudding user response:
You can use device_info_plus plugin to get the information for any platform.
This plugin supports null safety and is maintained by the flutter community.