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, account uniqueDeviceId
  • 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, account uniqueDeviceId
  • 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_id value uniqueDeviceId
  • 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.

  1. Update version in pubspec.yaml and add release notes in CHANGELOG.md.
  2. Ensure pub.dev automated publishing is enabled for this GitHub repository with tag pattern v{{version}}.
  3. Create and push a release tag that matches pubspec.yaml version, for example v1.0.1.
  4. The workflow runs analyze/test/dry-run and then publishes to pub.dev using OIDC.