Skip to content

A Flutter plugin that retrieves a stable device identifier across iOS, Android, macOS, Windows, and Linux, designed to remain consistent after app reinstall.

License

Notifications You must be signed in to change notification settings

OctMon/flutter_id

Repository files navigation

flutter_id

一个用于获取设备唯一标识的 Flutter 插件。核心目标是提供稳定的设备 ID:在正常情况下,即使删除并重新安装 App,ID 也不会改变。

功能

  • 获取设备 ID:getDeviceId()(稳定性优先,卸载重装不变)

安装

pubspec.yaml 中添加:

dependencies:
  flutter_id:

使用

import 'package:flutter_id/flutter_id.dart';

final flutterId = FlutterId();
final deviceId = await flutterId.getDeviceId();

平台实现说明

  • iOS:使用 Keychain 保存 UUID,卸载重装仍可读取。
  • Android:使用 Widevine 设备唯一 ID(MediaDrm)生成稳定标识。
  • macOS:读取 IOPlatformUUID。
  • Windows:读取系统 UUID(wmic csproduct get UUID)。
  • Linux:读取系统 UUID(dmidecode -s system-uuid)。

稳定性说明

设备 ID 的稳定性取决于平台底层标识是否被重置,例如系统重装、硬件更换、Keychain/DRM 记录被清除等。正常情况下,卸载重装 App 不会改变设备 ID。

许可

LICENSE

About

A Flutter plugin that retrieves a stable device identifier across iOS, Android, macOS, Windows, and Linux, designed to remain consistent after app reinstall.

Resources

License

Stars

Watchers

Forks

Packages

No packages published