Search packages, repositories and app categories

Package detailsv0.4.0

unique_identifier

A new Flutter plugin for fetching the unique identifier from android and ios.

AndroidiOS
30-day downloads
13.2K
Likes
58
Pub points
140

Install package

flutter pub add unique_identifier

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The unique_identifier package is a Flutter plugin that provides a simple way to retrieve a unique device identifier on both Android and iOS platforms. It leverages native APIs to ensure reliable and secure identification, making it useful for tracking, licensing, or user authentication purposes. The plugin is designed to be lightweight and easy to integrate, with minimal setup required. It respects platform-specific privacy guidelines and does not collect unnecessary data. This package is ideal for developers seeking consistent device identification across platforms without managing native code directly.

Use cases

  • Device tracking
  • App licensing
  • User authentication
  • Analytics
  • Session management

Key features

  • Cross-platform support (Android & iOS)
  • Simple API integration
  • Respects privacy guidelines
  • No additional permissions required
  • Secure identifier generation

Suitable for

  • Mobile app developers
  • Authentication systems
  • Licensing solutions
  • Analytics implementations
  • Privacy-conscious apps

Considerations

  • Identifier may change after app reinstall
  • Not suitable for high-security encryption
  • Depends on platform-specific implementation
  • May require user consent in some regions
  • Limited to device-level uniqueness

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Unique Identifier

pub package

A Flutter plugin to get the ANDROID_ID for android and identifierForVendor for iOS platforms.

Installing

dependencies:
  unique_identifier: ^0.4.0
Import
import 'package:unique_identifier/unique_identifier.dart';

How To Use

 dart String _identifier = 'Unknown';
  
 @override
 void initState() {
   super.initState();
   initUniqueIdentifierState();
 }

 Future<void> initUniqueIdentifierState() async {
   String identifier;
   try {
     identifier = await UniqueIdentifier.serial;
   } on PlatformException {
     identifier = 'Failed to get Unique Identifier';
   }

   if (!mounted) return;

   setState(() {
     _identifier = identifier;
   });
 }

 @override
 Widget build(BuildContext context) {
   return new MaterialApp(
     home: new Scaffold(
       appBar: new AppBar(
         title: const Text('Plugin example app'),
       ),
       body: new Center(
         child: new Text('Running on device with id: $_identifier\n'),
       ),
     ),
   );
 }

Bugs & Requests

If you encounter any bugs feel free to open an issue. Raise a ticket on github for suggestions. Pull request are also welcome.

Flutter

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

License

MIT License

NOTE

On Android 8.0 (API level 26) and higher versions of the platform, a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user, and device. Values of ANDROID_ID are scoped by signing key and user. The value may change if a factory reset is performed on the device or if an APK signing key changes. For more information about how the platform handles ANDROID_ID in Android 8.0 (API level 26) and higher, see Android 8.0 Behavior Changes. Note: For apps that were installed prior to updating the device to a version of Android 8.0 (API level 26) or higher, the value of ANDROID_ID changes if the app is uninstalled and then reinstalled after the OTA. To preserve values across uninstalls after an OTA to Android 8.0 or higher, developers can use Key/Value Backup. In versions of the platform lower than Android 8.0 (API level 26), a 64-bit number (expressed as a hexadecimal string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. On devices that have multiple users, each user appears as a completely separate device, so the ANDROID_ID value is unique to each user. Note: If the caller is an Instant App the ID is scoped to the Instant App, it is generated when the Instant App is first installed and reset if the user clears the Instant App.

Categories

Dependencies

Dependency list 1 items

  • plugin_platform_interface^2.0.2

Source repository

Projects using this package

No data available yet.