0 purchases
uuid v4
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
copied to clipboard
Usage #
Import the package:
import 'package:uuid_v4/uuid_v4.dart';
copied to clipboard
Interface your entity ID instead of importing this package everywhere:
typedef EntityId = UUIDv4;
final entityId = EntityId(); // Generates a new UUIDv4
copied to clipboard
Generate a new UUIDv4:
final entityId = UUIDv4();
print(entityId);
copied to clipboard
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');
}
copied to clipboard
Contributing #
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.