ios_utsname_ext
Método de extensão para tradução do utsname do iOS para o nome completo do produto.
Método de extensão para tradução do utsname do iOS para nome completo do produto (por exemplo, iPhone 6 Plus para 'iPhone7,1')
{"sdk":"flutter"}{"sdk":"flutter"}^1.8.0Texto original em inglês. Visite o GitHub para a versão atual.
pub package build Buy Me A Coffee
Extension method for translation ios utsname to full product name (e.g. iPhone 6 Plus for 'iPhone7,1').
When using the device_info package you get the following (extract from the readme file):
import 'package:device_info/device_info.dart';
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
print('Running on ${androidInfo.model}'); // e.g. "Moto G (4)"
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
print('Running on ${iosInfo.utsname.machine}'); // e.g. "iPhone7,1"
As you can see, for Android you get a rather good product name. But for iOS... you get iPhone7,1'. This extension package gives you the real product name by adding .iOSProductName`:
import 'package:ios_utsname_ext/extension.dart';
...
print('Running on ${iosInfo.utsname.machine.iOSProductName}'); // will give you `iPhone 6 Plus`
The list is maintained at https://github.com/fieldnotescommunities/ios-device-identifiers. The repo provides an updated .json file.
Based upon that .json file the code for this extension package is generated. When the repo is updated this
package will be updated.
API documentation can be found here