uuid_type 1.0.1-beta

  • Readme
  • Changelog
  • Installing
  • 65

UUID type for Dart 2 #

Build Status Pub GitHub

This package provides implementation of Universally Unique Identifier (UUID) for Dart, and supports generation, parsing and formatting of UUIDs.


  • [x] Creates UUID from string and byte-array, as well as GUID and URN strings
  • [x] Provides access to variant, version and byte data of UUID
  • [x] Generates RFC4122 time-based v1, random-based v4, and name & namespace based v5 UUIDs
  • [x] Implements Comparable for UUID comparison and lexicographical sorting
  • [x] Runs on Dart VM and in browser

RFC 4122 Version support:

  • [x] v1, based on timestamp and MAC address (RFC 4122)
  • [ ] v2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) Not planned
  • [ ] v3, based on MD5 hashing (RFC 4122) Not planned
  • [x] v4, based on random numbers (RFC 4122)
  • [x] v5, based on SHA-1 hashing (RFC 4122)

Requirements #

  • Dart 2 (tested with >=2.0.0). Should also work with Dart 1.24, but not tested.
  • crypto package to generate name based UUIDs

Getting Started #

Installation #

  1. Add an entry in your pubspec.yaml for uuid_type
  uuid_type: ^1.0.0
  1. Run pub get (flutter packages get for Flutter)
  2. Import
import 'package:uuid_type/uuid_type.dart';

1.0.0-beta #

  • More tests and documentation

0.9.0-beta #

  • Time-based generator is refactored to use Stopwatch instead of DateTime calls. Parameter clockSequence is now deprecated in TimeBasedUuidGenerator constructor
  • Comparison is refactored to treat v1 UUIDs differently
  • Abstract Uuid class now has compareTo method implemented

0.8.0-beta #

  • Refactored string parsing (does not affect API)
  • Added comparison operators > >= < <=

0.7.0-dev #

  • Dart 2.0 is a minimum required version

0.6.0-dev #

  • toBytes() method was renamed to bytes getter

0.5.2-dev #

  • Initial package documentation

0.5.1-dev #

  • Initial relase, and tests

Use this package as a library

1. Depend on it

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

  uuid_type: ^1.0.1-beta

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:uuid_type/uuid_type.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/uuid.dart. (-11.78 points)

Analysis of lib/src/uuid.dart reported 25 hints, including:

line 27 col 30: Unnecessary new keyword.

line 31 col 26: Unnecessary new keyword.

line 31 col 45: Unnecessary new keyword.

line 39 col 13: Unnecessary new keyword.

line 46 col 12: Unnecessary new keyword.

Fix lib/src/generators.dart. (-6.31 points)

Analysis of lib/src/generators.dart reported 13 hints, including:

line 20 col 23: Unnecessary new keyword.

line 23 col 32: Unnecessary new keyword.

line 38 col 7: Unnecessary new keyword.

line 51 col 33: Unnecessary new keyword.

line 60 col 16: Unnecessary new keyword.

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and uuid_type.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
crypto >=2.0.0 <3.0.0 2.1.4
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
typed_data 1.1.6
Dev dependencies
pedantic >=1.0.0
test ^1.3.0