uuid_v4 1.0.2 copy "uuid_v4: ^1.0.2" to clipboard
uuid_v4: ^1.0.2 copied to clipboard

A Dart package for generating and parsing UUID version 4 (RFC4122) strings.

uuid_v4 #

A Dart package for generating and parsing UUID version 4 (RFC4122) strings. UUIDv4 is a 128-bit identifier used to uniquely identify information in computer systems, generated randomly to ensure uniqueness.

Features #

  • Generate random UUIDv4 strings
  • Parse and validate UUIDv4 strings
  • Support for empty UUIDv4 with all zeros

Installation #

Run the following command:

flutter pub add uuid_v4

Usage #

Import the package:

import 'package:uuid_v4/uuid_v4.dart';

Interface your entity ID instead of importing this package everywhere:

typedef EntityId = UUIDv4;
final entityId = EntityId(); // Generates a new UUIDv4

Generate a new UUIDv4:

final entityId = UUIDv4();
print(entityId);

Parse a UUIDv4 string:

UUIDv4? uuid = UUIDv4.tryParse('123e4567-e89b-12d3-a456-426614174000');
  if (uuid != null) {
    print(uuid); // Outputs the parsed UUIDv4
  } else {
    print('Invalid UUIDv4 string');
  }

Contributing #

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

0
likes
150
points
233
downloads

Publisher

verified publisherwattshout.com

Weekly Downloads

A Dart package for generating and parsing UUID version 4 (RFC4122) strings.

Homepage
Repository (GitHub)
View/report issues

Topics

#uuid #identifier #id

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on uuid_v4