nuid 0.7.2

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 pub get

Alternatively, your editor might support pub get or flutter pub 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';
  
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 Jul 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/nuid.dart. (-0.50 points)

Analysis of lib/nuid.dart reported 1 hint:

line 8 col 23: Use lowercase_with_underscores when specifying a library prefix.

Dependencies

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

Admin