chance_dart library

Enums

Casing
CCType
card enum called CCType with 4 values: visa, mastercard, americanExpress, discover.
ChanceAlias

Functions

address() Address
It takes the addresses string, decodes it, parses it into a map, converts the map into a list of addresses, and returns a random address from that list
age({int? max}) int
age returns a random integer between 0 and 123
aliasToFunction(ChanceAlias alias, [Map<String, dynamic> args = const {}, dynamic extraValue]) → dynamic
It takes in a ChanceAlias and a Map of arguments and returns a dynamic value
amPm() String
Return a random element from a list containing the am and pm value.
animal() String
Return a random animal from the animals list.
areaCode() String
Return the country code of the current locale, or an empty string if it's not available.
birthday() String
It takes the user object from the store, parses the date of birth from it, and returns a string with the day, month, and year
boolean() bool
It returns a random boolean value.
cc({CCType? ccType, int? visaLength}) String
It takes in a credit card type and a length, and returns a valid credit card number
ccType() CCType
It returns a random value from the CCType enum.
cedi({int? max, int? min, int? fixed}) String
It returns a random number between the min and max values, with a fixed number of decimal places
character({bool? alpha, String? pool, bool? numeric, Casing? casing, bool? symbols}) String
Return a random character. Usage character() character({ pool: 'abcde' }) chance.character({ alpha: true }) chance.character({ numeric: true }) chance.character({ casing: 'lower' }) chance.character({ symbols: true })
city() String
Return the city of the address of the user.
coin() String
Return a random value from a set of two strings i.e the head and tail of a coin.
coordinates() Coordinate
Return the coordinates of the address of the user.
country() Country
It returns a random country from a list of countries.
currency({String? currencyKeyToRemove}) Currency
It takes a currency key to remove from the list of currencies, decodes the base64 encoded string, converts it to a map, removes the currency key if it's not null, converts the map to a list of currencies, and returns a random currency from the list
currencyPair() List<Currency>
Return a list of two currencies, where the second currency is not the same as the first currency.
date() String
Return a string containing the current day, month, and year, separated by dashes.
dice() String
dollar({int? max, int? min, int? fixed}) String
Generate a random dollar amount.
euro({int? max, int? min, int? fixed}) String
Generate a random euro value
exp() String
Return a string with the current month and year separated by a dash.
expMonth({bool? future}) String
Generate a random integer between 1 and 12, or a random integer between the current month and 12 if future is true.
expYear() String
Generate a random integer between the current year and the current year plus 10.
falsy({Set? pool}) → dynamic
Return a random falsy value (false, null, 0, ''). usages falsy() falsy({ pool: {null, '', 0} })
firstName() String
"Return the first name of the current user, or an empty string if the user is not logged in or the first name is not set."
floating({int? fixed, num? min, num? max}) double
It returns a random double point number between min and max
fullName() String
If a raandom user's name is not null, return the user's last name followed by a space followed by the user's first name.
gender() String
return a random user's gender, otherwise return an empty string.
generateUUID() String
Generates a UUID.
geohash() String
It takes a random address, gets the coordinates, and then uses the GeoHasher library to encode those coordinates into a geohash
hour() int
Returns a random integer between 0 and 999.
integer({int? min, int? max}) int
This function returns a random integer between min value and max value. If no argument if passed, it will generate random integers between 0 and 1,000,000,000.
lastName() String
If the user's name is not null, return the user's last name, otherwise return an empty string.
latitude() double
Return the latitude of the address of the current user.
letter({Casing? casing}) String
a function that returns a random letter.
locale() String
It returns the state of a random address.
longitude() double
Return the longitude of a randomly generated address.
millisecond() int
Returns a random integer between 0 and 999.
minute() int
Returns a random integer between 0 and 60.
month() String
returns a month of the year Return a random month of the year.
naira({int? max, int? min, int? fixed}) String
It returns a random number between the min and max values, with a fixed number of decimal places
natural({int? max}) int
Generate a random number between 0 and 1,000,000,000 (or a max value if provided).
paragraph({int? sentences, bool lineBreak = true}) String
It generates a paragraph of sentences.
personTitle() String
It returns the title of the user.
phone([String? temp]) String
It generates a random phone number.
postal() String
It takes a base64 encoded JSON string, decodes it, converts it to a map, gets the keys of the map, converts the keys to a list, and returns a random key from the list
postCode() String
Return a random postal code.
prime({int? max}) int
Return a random prime number, optionally between 1 and max.
second() int
Return a random integer between 0 and 60.
sentence() String
It returns a random sentence from the list of sentences
ssn() String
Generate a random 9 digit number, convert it to a string, and return it.
state() String
Return the state of a generated address.
street() String
Return a randomly generated address street.
string({int length = 5, int? max, String? pool, bool? alpha, Casing? casing, bool? symbols}) String
It generates a random string of characters from a given string of characters
syllable(String count) String
It takes a string, decodes it from base64, parses it as JSON, and returns a random element from the list of syllables that matches the input string
template(String temp) String
It takes a string and replaces all the 'a' characters with a random lowercase letter, all the 'A' characters with a random uppercase letter, and all the '#' characters with a random number
timeStamp() String
It returns a string that represents the current time in microseconds
weekday() String
Return a random weekday.
word() String
"Return a random word from the list of words."
year({int? max, int? min = 1701}) String
Generate a random year between 1701 and the current year.

Exceptions / Errors

ChanceException