FLUTTER ECOSYSTEM

stefandevo/flutter-ios-utsname-ext

iOS utsname를 전체 제품 이름으로 변환하는 확장 메서드 (예: 'iPhone7,1'을 'iPhone 6 Plus'로)

flutter-ios-utsname-ext 프로젝트 이미지
Stars
6
Forks
1
최근 푸시(UTC)
2023. 10. 19.
프로젝트 상태
보관됨
Stefan de Vogelaere GitHub avatar
GITHUB User

Stefan de Vogelaere ↗

.NET veteran, React developer.

DevosoftBelgium
언어DartRubySwiftKotlinObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • pedantic개발 의존성^1.8.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

ios_utsname_ext

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').

Why this extension package?

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`

Source of product models

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

API documentation can be found here