getUniqueIdentifier method
Returns the unique device identifier for the current platform.
May return null
if the platform cannot provide a valid identifier.
Platform behavior:
- Android: Returns
Settings.Secure.ANDROID_ID
- iOS: Returns
UIDevice.identifierForVendor
- macOS: Returns
IOPlatformUUID
using IOKit (macOS 12+:kIOMainPortDefault
, older:kIOMasterPortDefault
) - Windows: Reads the registry value
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid
- Linux: Reads from
/etc/machine-id
- Web: Returns a fingerprint-based hash if possible; otherwise, a random UUID is generated and stored in
localStorage
Implementation
Future<String?> getUniqueIdentifier() {
throw UnimplementedError('getUniqueIdentifier() has not been implemented.');
}