diff --git a/packages/device_info_plus/device_info_plus/example/integration_test/device_info_plus_test.dart b/packages/device_info_plus/device_info_plus/example/integration_test/device_info_plus_test.dart index 4ac06182d4..bf8cd3c970 100644 --- a/packages/device_info_plus/device_info_plus/example/integration_test/device_info_plus_test.dart +++ b/packages/device_info_plus/device_info_plus/example/integration_test/device_info_plus_test.dart @@ -116,8 +116,8 @@ void main() { expect(macosInfo.computerName, isNotNull); expect(macosInfo.hostName, isNotNull); expect(macosInfo.arch, isNotNull); + expect(macosInfo.model, isNotNull); expect(macosInfo.modelName, isNotNull); - expect(macosInfo.modelIdentifier, isNotNull); expect(macosInfo.kernelVersion, isNotNull); expect(macosInfo.osRelease, isNotNull); expect(macosInfo.activeCPUs, isNotNull); diff --git a/packages/device_info_plus/device_info_plus/example/lib/main.dart b/packages/device_info_plus/device_info_plus/example/lib/main.dart index 791e449998..c188b03538 100644 --- a/packages/device_info_plus/device_info_plus/example/lib/main.dart +++ b/packages/device_info_plus/device_info_plus/example/lib/main.dart @@ -112,6 +112,7 @@ class _MyAppState extends State { 'systemName': data.systemName, 'systemVersion': data.systemVersion, 'model': data.model, + 'modelName': data.modelName, 'localizedModel': data.localizedModel, 'identifierForVendor': data.identifierForVendor, 'isPhysicalDevice': data.isPhysicalDevice, @@ -165,8 +166,8 @@ class _MyAppState extends State { 'computerName': data.computerName, 'hostName': data.hostName, 'arch': data.arch, + 'model': data.model, 'modelName': data.modelName, - 'modelIdentifier': data.modelIdentifier, 'kernelVersion': data.kernelVersion, 'majorVersion': data.majorVersion, 'minorVersion': data.minorVersion, diff --git a/packages/device_info_plus/device_info_plus/ios/device_info_plus/Sources/device_info_plus/FPPDeviceInfoPlusPlugin.m b/packages/device_info_plus/device_info_plus/ios/device_info_plus/Sources/device_info_plus/FPPDeviceInfoPlusPlugin.m index 90cca1646d..ed49c2e575 100644 --- a/packages/device_info_plus/device_info_plus/ios/device_info_plus/Sources/device_info_plus/FPPDeviceInfoPlusPlugin.m +++ b/packages/device_info_plus/device_info_plus/ios/device_info_plus/Sources/device_info_plus/FPPDeviceInfoPlusPlugin.m @@ -41,8 +41,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call @"name" : [device name], @"systemName" : [device systemName], @"systemVersion" : [device systemVersion], - @"model" : deviceName, + @"model" : [device model], @"localizedModel" : [device localizedModel], + @"modelName" : deviceName, @"identifierForVendor" : [[device identifierForVendor] UUIDString] ?: [NSNull null], @"isPhysicalDevice" : isPhysicalNumber, diff --git a/packages/device_info_plus/device_info_plus/lib/src/model/ios_device_info.dart b/packages/device_info_plus/device_info_plus/lib/src/model/ios_device_info.dart index 31bf496977..aaf654a776 100644 --- a/packages/device_info_plus/device_info_plus/lib/src/model/ios_device_info.dart +++ b/packages/device_info_plus/device_info_plus/lib/src/model/ios_device_info.dart @@ -15,6 +15,7 @@ class IosDeviceInfo extends BaseDeviceInfo { required this.systemName, required this.systemVersion, required this.model, + required this.modelName, required this.localizedModel, this.identifierForVendor, required this.isPhysicalDevice, @@ -38,10 +39,14 @@ class IosDeviceInfo extends BaseDeviceInfo { /// https://developer.apple.com/documentation/uikit/uidevice/1620043-systemversion final String systemVersion; - /// Device model. - /// Examples: `iPhone 16 Pro`, `iPad Pro 11-Inch 3` + /// Device model according to OS + /// https://developer.apple.com/documentation/uikit/uidevice/1620044-model final String model; + /// Commercial or user-known model name + /// Examples: `iPhone 16 Pro`, `iPad Pro 11-Inch 3` + final String modelName; + /// Localized name of the device model. /// https://developer.apple.com/documentation/uikit/uidevice/1620029-localizedmodel final String localizedModel; @@ -68,6 +73,7 @@ class IosDeviceInfo extends BaseDeviceInfo { systemName: map['systemName'], systemVersion: map['systemVersion'], model: map['model'], + modelName: map['modelName'], localizedModel: map['localizedModel'], identifierForVendor: map['identifierForVendor'], isPhysicalDevice: map['isPhysicalDevice'], diff --git a/packages/device_info_plus/device_info_plus/lib/src/model/macos_device_info.dart b/packages/device_info_plus/device_info_plus/lib/src/model/macos_device_info.dart index bc10aea1f3..7725c5d1de 100644 --- a/packages/device_info_plus/device_info_plus/lib/src/model/macos_device_info.dart +++ b/packages/device_info_plus/device_info_plus/lib/src/model/macos_device_info.dart @@ -12,8 +12,8 @@ class MacOsDeviceInfo extends BaseDeviceInfo { required this.computerName, required this.hostName, required this.arch, + required this.model, required this.modelName, - required this.modelIdentifier, required this.kernelVersion, required this.osRelease, required this.majorVersion, @@ -35,14 +35,14 @@ class MacOsDeviceInfo extends BaseDeviceInfo { /// Note, that on Apple Silicon Macs can return `x86_64` if app runs via Rosetta final String arch; + /// Device model identifier + /// Examples: `MacBookPro18,3`, `Mac16,2`. + final String model; + /// Device model name /// Examples: `MacBook Pro (16-inch, 2021)`, `iMac (24-inch, 2024)`. final String modelName; - /// Device model identifier - /// Examples: `MacBookPro18,3`, `Mac16,2`. - final String modelIdentifier; - /// Machine Kernel version. /// Examples: /// `Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64` @@ -81,8 +81,8 @@ class MacOsDeviceInfo extends BaseDeviceInfo { computerName: map['computerName'], hostName: map['hostName'], arch: map['arch'], + model: map['model'], modelName: map['modelName'], - modelIdentifier: map['modelIdentifier'], kernelVersion: map['kernelVersion'], osRelease: map['osRelease'], majorVersion: map['majorVersion'], diff --git a/packages/device_info_plus/device_info_plus/macos/device_info_plus/Sources/device_info_plus/DeviceInfoPlusMacosPlugin.swift b/packages/device_info_plus/device_info_plus/macos/device_info_plus/Sources/device_info_plus/DeviceInfoPlusMacosPlugin.swift index 771fcbc7bf..a1f6823606 100644 --- a/packages/device_info_plus/device_info_plus/macos/device_info_plus/Sources/device_info_plus/DeviceInfoPlusMacosPlugin.swift +++ b/packages/device_info_plus/device_info_plus/macos/device_info_plus/Sources/device_info_plus/DeviceInfoPlusMacosPlugin.swift @@ -21,8 +21,8 @@ public class DeviceInfoPlusMacosPlugin: NSObject, FlutterPlugin { let computerName = Host.current().localizedName ?? Sysctl.hostName let hostName = Sysctl.osType let arch = Sysctl.machine + let model = Sysctl.model let modelName = getMacModelName(modelNumber: Sysctl.model) - let modelIdentifier = Sysctl.model let kernelVersion = Sysctl.version let osRelease = ProcessInfo.processInfo.operatingSystemVersionString let osVersion = ProcessInfo.processInfo.operatingSystemVersion; @@ -38,8 +38,8 @@ public class DeviceInfoPlusMacosPlugin: NSObject, FlutterPlugin { "computerName": computerName, "hostName": hostName, "arch": arch, + "model": model, "modelName": modelName, - "modelIdentifier": modelIdentifier, "kernelVersion": kernelVersion, "osRelease": osRelease, "majorVersion": majorVersion,