Skip to content

Conversation

@passsy
Copy link
Owner

@passsy passsy commented Jul 18, 2023

Official Dart 3 support, breaking changes, and new Alphabet API.

Breaking changes:

  • nanoid(10) is now nanoid(length: 10). The length parameter has been changed from an optional positional to an optional named parameter.
  • The async API import 'package:nanoid/async.dart'; has been removed. Call await Future(() {}); or before calling nanoid() to achieve the same effect.
  • Changed package name from import 'package:nanoid/nanoid.dart'; to import 'package:nanoid2/nanoid2.dart';
  • The insecure API import 'package:nanoid/non-secure.dart'; has been removed. Call nanoid(random: Random()); instead to force a non-secure (and faster) random number generator.
    nonoid() automatically uses Random() instead of Random.secure() on platforms that do not provide a cryptographically secure source of random numbers.
  • Removed the customAlphabet('custom', 10) API. Use nanoid(alphabet: 'custom', length: 10); instead.

New APIs:

  • The Alphabet class provides a set of predefined alphabets for various use cases.

Inspired by pd4d10/nanoid-dart#5

@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@0d20d8e). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff            @@
##             main        #1   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         1           
  Lines           ?        21           
  Branches        ?         0           
========================================
  Hits            ?        21           
  Misses          ?         0           
  Partials        ?         0           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@passsy passsy merged commit ec46bab into main Jul 18, 2023
@passsy passsy deleted the 2.0 branch July 18, 2023 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant