add examples and update readme
This commit is contained in:
@ -4,8 +4,9 @@ import 'package:teamhydra_idgen/teamhydra_idgen.dart';
|
||||
void main() async {
|
||||
IDGen idgen = IDGen(username: 'your_username', token: 'your_token');
|
||||
|
||||
// Generate a new ID, in this example we are generating a UUID V4
|
||||
IDGenResponse uuid =
|
||||
await idgen.generateUUIDV4(); // all generations are async
|
||||
print('Generated UUID: ${uuid.id}'); // print the generated ID
|
||||
// A more complex example can be generating a new IDs with a specific alphabet
|
||||
// and length
|
||||
IDGenResponse newID = await idgen.generateNanoID(
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', size: 20);
|
||||
print('New ID: ${newID.id}');
|
||||
}
|
||||
|
Reference in New Issue
Block a user