From 9caef5b7d2a2b635e8eb88606fd5e8d2f4fb43ac Mon Sep 17 00:00:00 2001 From: Kenneth Date: Thu, 30 Oct 2025 17:31:04 -0400 Subject: [PATCH] Update the device model name --- lib/src/platform_client.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/src/platform_client.dart b/lib/src/platform_client.dart index d35239e..e945d45 100644 --- a/lib/src/platform_client.dart +++ b/lib/src/platform_client.dart @@ -1493,13 +1493,27 @@ class PlatformClient { } else { return { 'id': (await _deviceId) ?? '', - 'model': (await DeviceInfoPlugin().deviceInfo).data['model'], + 'model': await _getDeviceModel(), 'platform': Platform.operatingSystem.toString().split('.').last, 'platformVersion': Platform.operatingSystemVersion, }; } } + Future? _getDeviceModel() { + if (kIsWeb) return null; + if (Platform.isAndroid) { + return DeviceInfoPlugin() + .androidInfo + .then((deviceInfo) => deviceInfo.model); + } else if (Platform.isIOS) { + return DeviceInfoPlugin() + .iosInfo + .then((deviceInfo) => deviceInfo.utsname.machine); // e.g: iPhone18,3 + } + return null; + } + Future get _deviceId async { if (_config.deviceId != null) { return _config.deviceId;