Nanoid class

Nano ID generator.

Constructors

Nanoid()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

alphanumeric({int length = 21, String prefix = ''}) String
Generate an ID using letters and digits only (no symbols).
custom({required int length, required String charSet, String prefix = ''}) String
Generate an ID using a custom charSet.
hex({int length = 32, String prefix = ''}) String
Generate an ID using hexadecimal characters (0-9, a-f).
lowercase({int length = 12, String prefix = ''}) String
Generate an ID using only lowercase letters and digits.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
numeric({int length = 6, String prefix = ''}) String
Generate an ID using only digits (0-9).
toString() String
A string representation of this object.
inherited
urlSafe({int length = 21, String prefix = '', String excludedCharSet = ''}) String
Generate an ID using the standard URL-safe Base64 charset.
urlSafeHumanFriendly({int length = 21, String prefix = '', String excludedCharSet = ''}) String
Generate an ID using a human-friendly URL-safe charset.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

collisionTime({required int length, required int charsetSize, required int idsPerHour}) Duration
Estimate how long it would take for a 1% collision probability, given the ID configuration and generation rate.
entropy({required int length, required int charsetSize}) double
Calculate the entropy in bits for a given configuration.