unique_ids 1.0.11
unique_ids: ^1.0.11

Flutter Android iOS

can create uuid and can get adid/idfa for mobile app(android/ios)

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:unique_ids/unique_ids.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _adId = 'Unknown';
  String _uuid = 'Unknown';

  @override
  void initState() {
    super.initState();
    _init();
  }

  Future<void> _init() async {
    String adId;
    String uuid;

    try {
      uuid = await UniqueIds.uuid;
    } on PlatformException {
      uuid = 'Failed to create uuid.v1';
    }

    try {
      adId = await UniqueIds.adId;
    } on PlatformException {
      adId = 'Failed to get adId version.';
    }

    if (!mounted) return;

    setState(() {
      _adId = adId;
      _uuid = uuid;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(
              children: [
                Text('Running on adId: $_adId\n'),
                Text('created uuid: $_uuid'),
              ],
            )),
      ),
    );
  }
}
0
likes
100
pub points
76%
popularity

can create uuid and can get adid/idfa for mobile app(android/ios)

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

tossy@tossy.me

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on unique_ids