my_device_info 0.2.0 copy "my_device_info: ^0.2.0" to clipboard
my_device_info: ^0.2.0 copied to clipboard

Privacy-aware, typed Android and iOS device diagnostics in one call, with an opt-in app-scoped identifier.

my_device_info #

pub package CI codecov

my_device_info provides privacy-aware, typed Android and iOS diagnostics. Version 0.2.0 can collect a complete snapshot with one native call while keeping the app-scoped identifier opt-in. It targets Flutter 3.47 and Dart 3.13.

Highlights #

  • One-call DeviceInfoSnapshot API instead of multiple platform round trips.
  • Typed platform and operating-system information.
  • Model identifier, CPU architecture, supported ABIs, physical-device hint, and Android low-RAM status.
  • App-scoped identifier excluded by default and redacted from JSON by default.
  • A replaceable platform interface for tests and future platform packages.
  • All 0.1.0 getters remain source-compatible.

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.2.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 DeviceInfoSnapshot info = await MyDeviceInfo.getInfo();

    print(info.platform);
    print(info.operatingSystem.version);
    print(info.model);
    print(info.architecture);
    print(info.supportedAbis);
    print(info.isPhysicalDevice);

    // JSON output excludes the app-scoped identifier.
    final Map<String, Object?> diagnostics = info.toJson();
  } on PlatformException catch (error) {
    // Handle a platform failure here.
  }
}

Request the app-scoped identifier only for a feature that actually needs it:

final DeviceInfoSnapshot info = await MyDeviceInfo.getInfo(
  includeDeviceIdentifier: true,
);

final String? identifier = info.deviceIdentifier;
final safeJson = info.toJson(); // Still excludes deviceIdentifier.
final fullJson = info.toJson(includeDeviceIdentifier: true);

Do not use the identifier as an authentication secret, advertising identifier, or permanent user identity. Avoid sending fullJson to logs or analytics by default. deviceName is platform-provided and can also contain a user-selected name.

Legacy getters #

The static getters from 0.1.0 remain available, including platformVersion, deviceIdentifier, deviceModel, deviceManufacturer, apiLevel, deviceName, productName, cpuName, and hardware. apiLevel still returns an int on Android and the system-version String on iOS for compatibility.

Migrating from 0.1.0 #

  • Prefer MyDeviceInfo.getInfo() when reading more than one field.
  • Use the typed operatingSystem.androidApiLevel instead of the legacy dynamic apiLevel getter.
  • Enable includeDeviceIdentifier only at the point where it is required.
  • JSON serialization now makes identifier inclusion an explicit second opt-in.

Migrating from 0.0.x #

  • Replace MyDeviceInfo.deviceIMEINumber with MyDeviceInfo.deviceIdentifier. The legacy getter is deprecated and now aliases the app-scoped identifier.
  • Remove READ_PHONE_STATE and 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.

Maintainers #

Support #

1
likes
160
points
116
downloads
screenshot

Documentation

API reference

Publisher

verified publisherwongcoupon.com

Weekly Downloads

Privacy-aware, typed Android and iOS device diagnostics in one call, with an opt-in app-scoped identifier.

Repository (GitHub)
View/report issues

Topics

#device-info #device-identifier #hardware #system-info #flutter-plugin

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on my_device_info

Packages that implement my_device_info