nuid 0.7.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 50

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.

0.7.0 #

Working with List<int> type because of TCP protocol user this type. Then, this will help to optimize NATS package

0.6.16 #

A translation of https://github.com/nats-io/node-nuid

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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  nuid: ^0.7.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:nuid/nuid.dart';
  
Version Uploaded Documentation Archive
0.7.2 Feb 21, 2019 Go to the documentation of nuid 0.7.2 Download nuid 0.7.2 archive
0.7.1 Feb 20, 2019 Go to the documentation of nuid 0.7.1 Download nuid 0.7.1 archive
0.7.0 Sep 29, 2018 Go to the documentation of nuid 0.7.0 Download nuid 0.7.0 archive
0.6.16 Mar 22, 2018 Go to the documentation of nuid 0.6.16 Download nuid 0.6.16 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Apr 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:nuid/nuid.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0