chance 3.1.2 copy "chance: ^3.1.2" to clipboard
chance: ^3.1.2 copied to clipboard

A minimalist set of functions to generate random numbers, strings etc.

example/main.dart

import 'package:chance/chance.dart';

String randomName() {
  var name = '';

  for (var i = 0; i < randomInt(2, 4); i++) {
    final consonant = randomString(1, pool: 'bcdfghjklmnpqrstvwxz');
    final vowel = randomString(1, pool: 'aeiou');
    name += consonant + vowel;
  }

  return name;
}

String randomDomain() {
  final name = randomName();
  final tld = randomItem(['com', 'net', 'org', 'me']);
  return '$name.$tld';
}

void main() {
  final name = randomName();
  final email = '$name@${randomDomain()}';
  final password = randomString(12, secure: true);

  print(name);
  print(email);
  print(password);
}
10
likes
160
pub points
45%
popularity

Publisher

verified publishervimuser.com

A minimalist set of functions to generate random numbers, strings etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on chance