Language:

Search

Generating UUIDs in Flutter | Dart

  • Share this:
post-title
post-title

The Flutter UUID is a unique identification for Android and iOS devices.  It can be used to generate a unique identifier for the device, which can be valuable in a variety of scenarios.

The UUID Flutter is composed of three parts:

  1. A first part is a 16-bit number created at random that identifies the device's manufacturer.
  2. A second part is an 8-bit number that specifies the type of device.
  3. A third part is another 16-bit number that identifies the individual phone or tablet.

UUIDs can be used to differentiate data. Today we will learn how to generate random UUIDs in Flutter using Dart.

The DART UUID package produces universally unique identifiers. It offers a straightforward API for generating UUIDs that are guaranteed to be unique over space and time. Because UUIDs are generated based on time and a random number, they are neither predictable nor reproducible.

Step 1: First we will add a library as shown below.

w-1

Step 2: After that, we will import the library.

ww

Step 3: Then we will create an object of the Uuid() Class, with the help of this object we will be able to generate random UUIDs.

w2

Step 4: In body property will first use Column Widget (no restrictions you can use any widget) and in Column widget, we will use children property because it allows us that we can use the list of widgets, and then we will use Card widget and in Card widget, we will use child argument/property and in child property, we will use ListTile widget. Then in ListTile widget, we will use two properties, the first title then subtitle and in these both properties we will use Text widget as shown below

w3

Step 5: After writing the code we will run the application and will get the following response.

w4
 

Video Tutorial:

 

Source Code:

https://github.com/ammarjavedofficial/uuids-flutter-dart

Ammar Javed

Ammar Javed

Still Learning | Still Searching | Still Exploring | The secret of your success is determined by your daily agenda.