nonce method

String nonce([
  1. int length = 32
])

Generates a cryptographically secure random nonce

Implementation

String nonce([int length = 32]) {
  const charset =
      '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._';
  return List.generate(length, (_) => charset[nextInt(charset.length)])
      .join();
}