How to Get a Persistent and User-Visible Unique Device Identifier in Flutter (iOS & Android)?
I am developing a Flutter application where I need a unique device identifier that meets the following criteria:
- Persists even after a factory reset (should not change).
- Is unique for each device (no duplicates across devices).
- Is visible to the user (so they can share it if needed).
- Can be used for security purposes (e.g., detecting trusted devices and blocking fraudulent ones).
If a native Android or iOS developer knows a way to do this natively, they can also share their approach.
Approaches I Have Tried
device_info_plus package:
- Provides androidId, but it resets after a factory reset.
- On iOS, identifierForVendor changes after an app reinstall.
flutter_secure_storage:
- Stores a generated UUID persistently, but it gets wiped after a factory reset.
Using IMEI or Serial Number:
- IMEI requires special permissions and is restricted on newer Android version
- Serial numbers are no longer accessible on newer Android versions and iOS.
Question
What is the best way to obtain a truly persistent, unique, and user-visible device identifier in Flutter?
If there is no built-in method, what alternative solutions exist (e.g., external device fingerprinting services or a combination of multiple identifiers)?