device_market_name
Small package which returns market name for device model code, e.g. SM-G970F => Galaxy S10e, iPhone13,2 => iPhone 12. Works for Android devices with Google Play services & iOS devices.
Usage
import 'package:device_market_name/device_market_name.dart';
// For current platform
final name = await DeviceMarketName().getMarketName('SM-G970F'); // Galaxy S10e
// For another platform
await DeviceMarketName()
.getMarketName('iPhone14,2', platform: TargetPlatform.iOS); // iPhone 13 Pro
// iOS name without network id (GSM, CDMA, LTE and etc)
await DeviceMarketName().getMarketName('iPhone5,1'); // iPhone 5 (GSM)
await DeviceMarketName()
.getMarketName('iPhone5,1', withoutNetwork: true); // iPhone 5
Returns null for unknown model codes and throws for platforms other than Android & iOS.
To get model code of current device use e.g. device_info_plus:
- Android:
(await DeviceInfoPlugin().androidInfo).model - iOS:
(await DeviceInfoPlugin().iosInfo).utsname.machine
Databases
- Android: Google Play supported devices
- iOS: ios-device-identifiers
Databases are bundled with the package and cached in app documents directory. Lookups never wait for network: cached databases are refreshed in background once a week, so new devices appear without package update. Broken downloads never replace cached databases.
Requirements
Dart 3.12 / Flutter 3.44 or newer.
Updating bundled databases
Requires requests:
python3 db_update.py