Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get device model name in flutter

Tags:

flutter

I'm using device_info_plus plugin to get device info but I couldn't get the model name.

the device name is changing and the

utsname.machine

don't give me the right name

what to do to get the right device name in a flutter project.

like image 644
Tabarek Ghassan Avatar asked Oct 15 '25 19:10

Tabarek Ghassan


2 Answers

How about using apple_product_name package?

import 'package:apple_product_name/apple_product_name.dart';
import 'package:device_info_plus/device_info_plus.dart';

if (Platform.isIOS) {
  final info = await DeviceInfoPlugin().iosInfo;
  print(info.utsname.machine);      // "iPhone15,2"
  print(info.utsname.productName);  // "iPhone 14 Pro"
}

You can get the model name of iOS devices.

FYI, I'm author of this package.

like image 128
Kyle Seongwoo Jun Avatar answered Oct 17 '25 07:10

Kyle Seongwoo Jun


For those who face such an issue I used Apple's mobile device codes to display the device model name from the machine code

like image 45
Tabarek Ghassan Avatar answered Oct 17 '25 07:10

Tabarek Ghassan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!