Dart implementation of ai/nanoid
Add nanoid
as a dependency in your pubspec.yaml file
import 'package:nanoid/nanoid.dart';
void main() {
var id = nanoid();
var custom_length_id = nanoid(10);
// ...
}
import 'package:nanoid/nanoid.dart';
void main() {
var id = customAlphabet('1234567890abcdef', 10);
// ...
}
import 'package:nanoid/async.dart';
void main() async {
var id = await nanoid();
var custom_length_id = await nanoid(10);
// ...
}
import 'package:nanoid/non_secure.dart';
void main() {
var non_secure_id = nanoid();
var custom_length_id = nanoid(10);
// ...
}
MIT