Flutter Device Platform ID
A Flutter plugin for getting a unique device identifier across multiple platforms.
Supported Platforms
| Platform | Identifier Source | Persistence | Reset Conditions |
|---|---|---|---|
| Android | Settings.Secure.ANDROID_ID |
System | Factory reset, signing key change |
| iOS | Keychain stored UUID | Keychain | Keychain cleared, app reinstall |
| macOS | Keychain stored UUID | Keychain (per-user) | Keychain cleared |
| Windows | Registry stored UUID | HKCU Registry (per-user) | Profile reset, registry cleared |
| Web | localStorage stored UUID | Browser storage | Site data cleared, incognito mode |
Installation
Add this to your package's pubspec.yaml file:
dependencies:
flutter_device_platform_id: ^1.0.1
Usage
import 'package:flutter_device_platform_id/flutter_device_platform_id.dart';
// Get the unique device ID
String? uniqueId = await FlutterDevicePlatformId().getUniqueId();
// Get the platform version
String? platformVersion = await FlutterDevicePlatformId().getPlatformVersion();
Platform-Specific Details
Android
- Source:
Settings.Secure.ANDROID_ID - Format: 16+ character hexadecimal string
- Persistence: Survives app reinstalls
- Reset: Factory reset or signing key change
iOS
- Source: UUID stored in Keychain via KeychainAccess library
- Format: UUID (8-4-4-4-12)
- Storage: Keychain service
com.shareinvest.unique_id, accountuniqueDeviceId - Persistence: Survives app reinstalls
- Reset: Keychain cleared or device restore
macOS
- Source: UUID stored in macOS Keychain
- Format: UUID (8-4-4-4-12)
- Storage: Keychain service
com.shareinvest.unique_id, accountuniqueDeviceId - Persistence: Per-user, survives app reinstalls
- Reset: Keychain cleared
- Requirements: Keychain entitlements for sandboxed apps
Windows
- Source: UUID stored in Windows Registry
- Format: UUID (8-4-4-4-12)
- Storage:
HKEY_CURRENT_USER\Software\com.shareinvest\flutter_device_platform_idvalueuniqueDeviceId - Persistence: Per-user, survives app reinstalls
- Reset: Registry cleared or user profile reset
Web
- Source: UUID stored in browser localStorage
- Format: UUID (8-4-4-4-12)
- Storage: localStorage key
flutter_device_platform_id.uniqueDeviceId - Fallback: sessionStorage → in-memory (for private browsing)
- Persistence: Browser-profile scoped
- Reset: Site data cleared, incognito/private mode
- Note: Does NOT use fingerprinting, MAC addresses, or IP addresses
Privacy & Compliance
Important: This plugin provides a device-scoped identifier, NOT an advertising identifier.
- ✅ Intended use: Correlate a single device/browser-profile across multiple login providers
- ❌ NOT for: Cross-app tracking, advertising, analytics across different apps/sites
- 🔒 Privacy: No fingerprinting, no MAC addresses, no IP addresses (Web)
- 📱 Scope: App-scoped (mobile/desktop), browser-profile scoped (web)
Requirements
- Dart SDK:
>=3.5.0 <4.0.0 - Flutter SDK:
>=3.24.0
Example
See the example directory for a complete sample app demonstrating usage on all platforms.
License
See LICENSE file.
Maintainer
ShareInvest Corp.
Release (Maintainers)
This repository includes a tag-driven GitHub Actions workflow at .github/workflows/publish.yml.
- Update
versioninpubspec.yamland add release notes inCHANGELOG.md. - Ensure pub.dev automated publishing is enabled for this GitHub repository with tag pattern
v{{version}}. - Create and push a release tag that matches
pubspec.yamlversion, for examplev1.0.1. - The workflow runs analyze/test/dry-run and then publishes to pub.dev using OIDC.