Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefandevo/flutter-ios-utsname-ext
Extension method for translation ios utsname to full product name (e.g. iPhone 6 Plus for 'iPhone7,1')
https://github.com/stefandevo/flutter-ios-utsname-ext
Last synced: 2 months ago
JSON representation
Extension method for translation ios utsname to full product name (e.g. iPhone 6 Plus for 'iPhone7,1')
- Host: GitHub
- URL: https://github.com/stefandevo/flutter-ios-utsname-ext
- Owner: stefandevo
- License: mit
- Created: 2020-06-25T17:25:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-19T16:13:53.000Z (over 1 year ago)
- Last Synced: 2023-10-19T17:24:54.478Z (over 1 year ago)
- Language: Dart
- Size: 84 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ios_utsname_ext
[![pub package](https://img.shields.io/pub/v/ios_utsname_ext.svg)](https://pub.dartlang.org/packages/ios_utsname_ext) ![build](https://github.com/stefandevo/flutter-ios-utsname-ext/workflows/build/badge.svg?branch=master)
Extension method for translation ios utsname to full product name (e.g. iPhone 6 Plus for 'iPhone7,1').
## Why this extension package?
When using the [device_info](https://pub.dev/packages/device_info) package you get the following (extract from the readme file):
``` dart
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`:``` dart
import 'package:ios_utsname_ext/extension.dart';...
print('Running on ${iosInfo.utsname.machine.iOSProductName}'); // will give you `iPhone 6 Plus`
```## Source of product models
The list is maintained at [https://github.com/fieldnotescommunities/ios-device-identifiers](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
API documentation can be found [here](https://pub.dev/documentation/ios_utsname_ext/latest/)