generateUUID function
Generates a UUID.
Returns: A string of 36 characters.
Implementation
String generateUUID() {
final microSecond = DateTime.now().microsecond;
/// Generating a random UUID.
final uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.split('')
.map(
(value) => value
.replaceAll(
'x',
_replacer('x', microSecond + Random().nextInt(10)),
)
.replaceAll(
'y',
_replacer('y', microSecond),
),
)
.join();
return uuid;
}