Refactor API for 2.0.0 release #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Official Dart 3 support, breaking changes, and new Alphabet API.
Breaking changes:
nanoid(10)is nownanoid(length: 10). Thelengthparameter has been changed from an optional positional to an optional named parameter.import 'package:nanoid/async.dart';has been removed. Callawait Future(() {});or before callingnanoid()to achieve the same effect.import 'package:nanoid/nanoid.dart';toimport 'package:nanoid2/nanoid2.dart';import 'package:nanoid/non-secure.dart';has been removed. Callnanoid(random: Random());instead to force a non-secure (and faster) random number generator.nonoid()automatically usesRandom()instead ofRandom.secure()on platforms that do not provide a cryptographically secure source of random numbers.customAlphabet('custom', 10)API. Usenanoid(alphabet: 'custom', length: 10);instead.New APIs:
Alphabetclass provides a set of predefined alphabets for various use cases.Inspired by pd4d10/nanoid-dart#5