Skip to content
pubscout

nanoid

1.0.0, released 6 years ago by an unverified publisher

A tiny, secure, URL-friendly, unique string ID generator.

WASM-readySingle maintainer
$ flutter pub add nanoid
Source repository

What it does

Generates unique string IDs in Dart with support for custom alphabets, custom lengths, async generation, and non-secure modes. It is a Dart port of the popular ai/nanoid library.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need unique, URL-friendly string identifiers
  • You require custom ID lengths or custom alphabets

Skip it when

  • You specifically require standard UUID formats (use uuid instead)

Strengths

  • Tiny and lightweight with no dependencies
  • Supports secure, non-secure, and async generation APIs

Weaknesses

  • Limited scope restricted entirely to ID generation

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:nanoid/nanoid.dart';

void main() {
  var id = nanoid();
  var custom_length_id = nanoid(10);
}

Alternatives

Packages that do the same job and could replace nanoid.

  • uuid

    If you specifically need standard Universally Unique Identifiers (UUID) instead of compact URL-friendly IDs.

Works with

Packages commonly used together with nanoid: ones it builds on, ones built on it, and its own family.