codecov GitHub Buy Me A Coffee PayPal Sponsor Support Me on Ko-fi

my_device_info is a Flutter plugin that returns device info such as IMEI (Android), model, manufacturer, API level, CPU type, product name, and hardware for Android and iOS.

Features

  • Simple static API for common device fields.
  • Works on Android and iOS.
  • Optional IMEI on Android with runtime permission.

Installation

Add following dependency in pubspec.yaml file:

my_device_info: ^last_version

Then, run

$ flutter pub get 

Set up

  • In android add following permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

Usage

import 'package:my_device_info/my_device_info.dart';

if(Permission.phone.request().isGranted){
  try {
      platformVersion = await MyDeviceInfo.platformVersion;
      imeiNo = await MyDeviceInfo.deviceIMEINumber;
      modelName = await MyDeviceInfo.deviceModel;
      manufacturer = await MyDeviceInfo.deviceManufacturer;
      apiLevel = await MyDeviceInfo.apiLevel;
      deviceName = await MyDeviceInfo.deviceName;
      productName = await MyDeviceInfo.productName;
      cpuType = await MyDeviceInfo.cpuName;
      hardware = await MyDeviceInfo.hardware;

  } on PlatformException {
      platformVersion = 'Failed to get platform version.';
  }
}

Developer Team:

ThaoDoan and DucNguyen

Libraries

my_device_info