搜索插件、代码仓与 APP 分类

插件详情v2.3.0

ios_utsname_ext

用于将 iOS utsname 转换为完整产品名称的扩展方法。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
3.8万
喜欢数
24
Pub 分数
150

安装插件

flutter pub add ios_utsname_ext

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

ios_utsname_ext 包提供了一个扩展方法,可将 iOS 设备的 utsname(系统信息)转换为人类可读的完整产品名称。它简化了从底层系统数据中识别确切设备型号的过程,对于分析、调试或个性化用户体验非常有用。该包适用于所有 Flutter 平台,包括 iOS、Android、Web、macOS、Windows 和 Linux,使跨平台应用更加灵活。它轻量级且设计用于无缝集成,设置简单。

适合场景

  • 分析中的设备识别
  • 调试设备特定问题
  • 根据硬件个性化用户体验
  • 跨平台设备检测
  • 在应用设置中显示准确的设备名称

主要特点

  • utsname 转换的扩展方法
  • 支持所有 Flutter 平台
  • 轻量且易于集成
  • 将 utsname 准确映射到产品名称
  • 无外部依赖

适合对象

  • 开发跨平台应用的开发者
  • 需要精确设备识别的应用
  • 分析和调试工具
  • 面向用户的设备信息显示

使用建议

  • 依赖iOS提供的准确utsname数据
  • 仅限iOS设备名称(不适用于其他平台)
  • 可能需要运行时访问系统信息
  • 非设备特定功能不需要

原始 README

以下为关联源码仓库的 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

所属分类

源码仓库

使用此插件的项目

暂无相关数据。