cuidConfig function

Cuid cuidConfig({
  1. int length = 24,
  2. int counter()?,
  3. String fingerprint()?,
  4. bool secure = false,
})

Creates a generator with the given options.

length optional sets the length of the generated IDs (default is 24).

counter optional custom session counter function. Ex. with increments of 5:

  myCounter(int start) => () => count+=5;
  final config = cuidConfig(counter: myCounter(3));

fingerprint optional custom fingerprint function:

  String myfingerprint() => "uniqueFingerprint123";
  final config = cuidConfig(fingerprint: myfingerprint);

secure optional uses Random.secure() when set to true (if available), otherwise (default & fallback) it uses Random()

Implementation

Cuid cuidConfig(
        {int length = 24,
        int Function()? counter,
        String Function()? fingerprint,
        bool secure = false}) =>
    Cuid(length, secure, counter, fingerprint);