chance 0.9.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 44

chance #

A random generator for Dart. Inspired by chancejs.

Currently has only basic capabilities. Feel free to contribute.

Usage #

import 'package:chance/chance.dart';

final chance = new Chance();

int randomInteger = chance.integer(min: 3, max: 12);

double randomDouble = chance.floating(min: 3.0, max: 12.0);

bool randomBool = chance.boolean(likelihood: 30.0);

Documentation #

https://pub.dartlang.org/documentation/chance/

License #

This project is licensed under the MIT License - see the LICENSE file for details

0.9.0 #

  • Move repository from Github to Gitlab
  • Minor refactoring

0.1.4 #

  • Add minMax parameter to integer and floating methods: So instead of integer(min: -value, max: value); you may now write integer(minMax: value); or integer(minMax: -value);
  • Minor refactoring

0.1.3 #

  • Fix typo in exception message
  • Minor refactoring

0.1.2 #

  • Add boolean method

0.1.1 #

  • Add some documentation
  • Add exceptions if min argument is provided without max

0.1.0 #

Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  chance: ^0.9.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ 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:


import 'package:chance/chance.dart';
  
Version Uploaded Documentation Archive
0.9.1 Jul 30, 2018 Go to the documentation of chance 0.9.1 Download chance 0.9.1 archive
0.9.0 Jul 17, 2018 Go to the documentation of chance 0.9.0 Download chance 0.9.0 archive
0.1.4 Mar 31, 2018 Go to the documentation of chance 0.1.4 Download chance 0.1.4 archive
0.1.3 Mar 29, 2018 Go to the documentation of chance 0.1.3 Download chance 0.1.3 archive
0.1.2 Mar 29, 2018 Go to the documentation of chance 0.1.2 Download chance 0.1.2 archive
0.1.1 Mar 28, 2018 Go to the documentation of chance 0.1.1 Download chance 0.1.1 archive
0.1.0 Mar 28, 2018 Go to the documentation of chance 0.1.0 Download chance 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
76
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

We analyzed this package on May 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.16

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:chance/chance.dart.

Health suggestions

Fix lib/chance.dart. (-3.45 points)

Analysis of lib/chance.dart reported 7 hints, including:

line 26 col 7: DO use curly braces for all flow control structures.

line 49 col 7: DO use curly braces for all flow control structures.

line 68 col 7: DO use curly braces for all flow control structures.

line 71 col 7: DO use curly braces for all flow control structures.

line 78 col 7: DO use curly braces for all flow control structures.

Maintenance suggestions

The package description is too short. (-14 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and chance.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <3.0.0
Dev dependencies
test ^1.3.0