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