nuid 1.0.0 copy "nuid: ^1.0.0" to clipboard
nuid: ^1.0.0 copied to clipboard

outdated

A Dart implementation of NATS (nats.io) Unique Identifiers (uid) inspired by github.com/nats-io/node-nuid.

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.nextBytes()}');
  }

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

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

As code above shows, there are two methods: next and nextBytes. 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.

6
likes
0
pub points
39%
popularity

Publisher

unverified uploader

A Dart implementation of NATS (nats.io) Unique Identifiers (uid) inspired by github.com/nats-io/node-nuid.

Homepage

Documentation

Documentation

License

unknown (LICENSE)

More

Packages that depend on nuid