Skip to content
A Dart-lang implementation of NATS Unique Identifiers
Dart
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
lib
.gitignore
CHANGELOG.md
LICENSE
README.md
pubspec.yaml

README.md

dart-nuid

A Dart-lang implementation of NATS Unique Identifiers inspired by node-nuid The NUID contains numbers and capital letters only, i.e. it works with base 36.

Examples:

Run the example/main.dart:

dart example/main.dart
import 'package:nuid/nuid.dart';

void main() {
  print('String:');
  print('  First nuid:');
  for(var i = 0; i < 4; i++){
    print('  - ${nuid.next()}');
  }

  print('  Reseting nuid:');
  nuid.reset();

  for(var i = 0; i < 4; i++){
    print('  - ${nuid.next()}');
  }

  print('\nBytes:');
  print('  First nuid:');
  for(var i = 0; i < 4; i++){
    print('  - ${nuid.next_bytes()}');
  }

  print('  Reseting nuid:');
  nuid.reset();

  for(var i = 0; i < 4; i++){
    print('  - ${nuid.next_bytes()}');
  }
}

As code above shows, there are two methods: next and next_bytes. They return the nuid in a String and List<int> format respectively. The lastone is designed to be compatible with Socket in dart:io library.

You can’t perform that action at this time.