getDeviceId abstract method
Gets the current device's unique identifier.
Returns a stable UUIDv4 that uniquely identifies this app install/profile. The ID is generated once and persisted locally:
- Mobile/Desktop: SharedPreferences
- Web: IndexedDB → localStorage → in-memory fallback
Stability
- Stable across app restarts
- May reset on uninstall/reinstall (mobile/desktop)
- May reset on "Clear site data" (web)
- Web is best-effort (storage can be cleared/blocked)
Returns
The device ID string (UUIDv4 format).
Example
final deviceId = await deviceService.getDeviceId();
print('Device ID: $deviceId');
// Output: Device ID: 550e8400-e29b-41d4-a716-446655440000
Implementation
Future<String> getDeviceId();