my_device_info
my_device_info reads common Android and iOS device details through a small
static Dart API. Version 0.1.0 targets Flutter 3.47 and Dart 3.13.
Supported platforms
| Platform | Minimum version | Identifier source |
|---|---|---|
| Android | API 24 | Settings.Secure.ANDROID_ID |
| iOS | 15.0 | UIDevice.identifierForVendor |
No runtime permission is required. The identifier is scoped by the operating
system; it is not an IMEI, advertising ID, or permanent account identifier.
Android scopes ANDROID_ID to the signing key, user, and device on API 26+.
iOS shares identifierForVendor between apps from the same vendor. Both values
can change, so applications must not treat them as permanent identity.
Installation
dependencies:
my_device_info: ^0.1.0
Then run:
flutter pub get
Usage
import 'package:flutter/services.dart';
import 'package:my_device_info/my_device_info.dart';
Future<void> loadDeviceInfo() async {
try {
final platformVersion = await MyDeviceInfo.platformVersion;
final deviceIdentifier = await MyDeviceInfo.deviceIdentifier;
final model = await MyDeviceInfo.deviceModel;
final manufacturer = await MyDeviceInfo.deviceManufacturer;
final apiLevel = await MyDeviceInfo.apiLevel;
final deviceName = await MyDeviceInfo.deviceName;
final productName = await MyDeviceInfo.productName;
final cpuName = await MyDeviceInfo.cpuName;
final hardware = await MyDeviceInfo.hardware;
} on PlatformException catch (error) {
// Handle a platform failure here.
}
}
apiLevel returns an int on Android and the system-version String on iOS.
This historical return type remains unchanged for compatibility.
Migrating from 0.0.x
- Replace
MyDeviceInfo.deviceIMEINumberwithMyDeviceInfo.deviceIdentifier. The legacy getter is deprecated and now aliases the app-scoped identifier. - Remove
READ_PHONE_STATEand any phone permission prompt that existed only for this package. - Android now requires API 24 or later; iOS now requires 15.0 or later.
Development
See doc/OPERATIONS.md for the validation and release commands used by this repository.