UUID type for Dart 2 #
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
Comparablefor 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)
- Dart 2 (tested with >=2.0.0). Should also work with Dart 1.24, but not tested.
cryptopackage to generate name based UUIDs
Getting Started #
- Add an entry in your
dependencies: uuid_type: ^1.0.0
flutter packages getfor Flutter)
- More tests and documentation
- Time-based generator is refactored to use
clockSequenceis now deprecated in
- Comparison is refactored to treat v1 UUIDs differently
Uuidclass now has
- Refactored string parsing (does not affect API)
- Added comparison operators
- Dart 2.0 is a minimum required version
toBytes()method was renamed to
- Initial package documentation
- 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:
$ pub get
$ 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:
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]
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
lib/src/uuid.dart. (-11.78 points)
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.
lib/src/generators.dart. (-6.31 points)
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.
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
uuid_type.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.