[Bug]: macOS modelName returns "Unknown Model" for Mac mini (case mismatch in identifier table)
還沒有人認領這個 Issue。
評估
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 新手友好度
- 91/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 領域
- mobile-dev
研究方向
在 DeviceIdentifiers.swift 中,Mac mini 項目使用 "MacMini9,1" 這類識別碼,而 issue 回報 hw.model 傳回 "Macmini9,1"。閱讀查找表,並確認 switch 如何處理這些字串。完成條件是受影響的識別碼與回報中的大小寫一致,且 Mac mini 型號名稱能正確解析。
由索引模型根據 Issue 內容生成。
描述
Platform
macOS
Plugin
device_info_plus
Version
13.3.0
Flutter SDK
3.47.5
Steps to reproduce
On a Mac mini (M1, 2020), MacOsDeviceInfo.modelName returns "Unknown Model", even though the device's identifier is in the lookup table.
hw.model reports the identifier as Macmini9,1 (lowercase "m" in "mini"). In DeviceIdentifiers.swift the Mac mini entries are written with an uppercase "M":
case "MacMini6,1", "MacMini6,2": return "Mac mini (2012)"
case "MacMini7,1": return "Mac mini (2014)"
case "MacMini8,1": return "Mac mini (2018)"
case "MacMini9,1": return "Mac mini (2020)"
Swift switch compares strings case-sensitively, so "Macmini9,1" doesn't match "MacMini9,1" and the lookup falls through to default: return "Unknown Model".
Steps to reproduce
Run any app that uses DeviceInfoPlugin().macOsInfo on a Mac mini with an identifier of Macmini6,x to Macmini9,1.
Read model and modelName.
Actual
model: Macmini9,1
modelName: Unknown Model
Expected
model: Macmini9,1
modelName: Mac mini (2020)
Suggested fix
Change the five MacMini identifiers in DeviceIdentifiers.swift to Macmini, matching the value hw.model returns:
case "Macmini6,1", "Macmini6,2": return "Mac mini (2012)"
case "Macmini7,1": return "Mac mini (2014)"
case "Macmini8,1": return "Mac mini (2018)"
case "Macmini9,1": return "Mac mini (2020)"
Newer Mac mini models (Mac14,3, Mac14,12, Mac16,10, Mac16,11) use the MacNN,N format and aren't affected.
Code Sample
Logs
No exception is thrown. Minimal output from `DeviceInfoPlugin().macOsInfo` on a Mac mini (M1, 2020):
model: Macmini9,1
modelName: Unknown Model
arch: arm64
majorVersion: 27
minorVersion: 0
patchVersion: 1
osRelease: Version 27.0.1 (Build 26A434)
Flutter Doctor
[✓] Flutter (Channel stable, 3.47.5, on macOS 27.0.1 26A434 darwin-arm64, locale en-US)
• Flutter version 3.47.5 on channel stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 6a19cca564 (8 weeks ago), 2026-09-17 14:13:22 -0400
• Engine revision af7e796e16
• Dart version 3.13.4
• DevTools version 2.60.0
[!] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
• Platform android-37.0, build-tools 36.1.0
• Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
! Some Android licenses not accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 27.2)
• Build 27B52
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
• Pixel 8 (mobile) • <redacted> • android-arm64 • Android 17 (API 37)
• macOS (desktop) • macos • darwin-arm64 • macOS 27.0.1 26A434 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 157.0.8103.78
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
Checklist before submitting a bug
- I searched issues in this repository and couldn't find such bug/problem
- I Google'd a solution and I couldn't find it
- I searched on StackOverflow for a solution and I couldn't find it
- I read the README.md file of the plugin
- I'm using the latest version of the plugin
- All dependencies are up to date with
flutter pub upgrade - I did a
flutter clean - I tried running the example project
- 主要語言
- Dart
- 星號
- 1.9k
- 分支
- 1.3k
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
fluttercommunity/plus_plugins 的其他 Issue
-
bug triage
難度 2/5 1-3 小時 新手友好度 66/100
fluttercommunity/plus_plugins#4018 ·
-
[Bug]: (share_plus) iOS drops the subject when sharing a uri可能已有人在做 @kaluli123123 於 43 天前認領。 未關閉bug triage
難度 2/5 1-3 小時 新手友好度 82/100
fluttercommunity/plus_plugins#3994 · 1 則留言 ·
-
enhancement triage
難度 3/5 1-2 天 新手友好度 55/100
fluttercommunity/plus_plugins#4019 ·
-
question
難度 4/5 3-5 天 新手友好度 48/100
fluttercommunity/plus_plugins#4015 ·
-
[Bug]: device_info_plus on Linux keeps the single quotes from os-release (Gentoo)可能已有人在做 @ChandraChaan 於 20 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 35/100
fluttercommunity/plus_plugins#4011 ·
查看 fluttercommunity/plus_plugins 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
OscillateLabsLLC/ovos-gui-visage#52 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
VeryGoodOpenSource/vgv_ai_cli#150 · 1 個 reaction ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 75/100
PATILYASHH/XPENC#206 · 1 則留言 ·
-
bug
難度 2/5 1-3 小時 新手友好度 82/100
fireplacechat/mobile#205 ·
維護者通常 1 天內回覆