uuid_type 1.0.1-beta

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.

Features:

  • [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
dependencies:
  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:


dependencies:
  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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Aug 18, 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:uuid_type/uuid_type.dart.

Health suggestions

Format lib/src/generators.dart.

Run dartfmt to format lib/src/generators.dart.

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
crypto >=2.0.0 <3.0.0 2.1.1+1
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