dart_mock library
A dart library to get the mock value.
Only basic type values can now be mocked.
Enums
- ImageFormat
- image format.
Constants
-
cfirstNames
→ const List<
String> - common chinese firstName, from 'http://www.name999.net/xingming/xingshi/20131004/48.html'.
- chineseCharacters → const String
- Commonly used 500 Chinese characters, from 'http://baike.baidu.com/view/568436.htm'.
-
citiesData
→ const Map<
String, dynamic> - chinese cities.
-
clastNames
→ const List<
String> - common chinese lastName, from (http://baike.baidu.com/view/1719115.htm' and 'http://xuanpai.sinaapp.com'.
-
firstNames
→ const List<
String> - Beyond the top 1000 names, from 'http://www.ssa.gov/oact/babynames/limits.html'.
-
lastNames
→ const List<
String> - lower → const String
- lower case letters.
- maxDate → const int
- max dateTime, equal 2099-12-31 23:59:59:999.
- maxInteger → const int
- max int value, equal to 2^63-1.
- number → const String
- numbers.
-
protocols
→ const List<
String> - common protocols.
-
provincesData
→ const Map<
String, String> - chinese provinces.
-
regions
→ const List<
String> - chinese regions.
-
sizes
→ const List<
String> - common ad image sizes.
- symbol → const String
- symbols.
-
tlds
→ const List<
String> - common tlds, from 'http://www.163ns.com/zixun/post/4417.html'.
- upper → const String
- upper case letters.
Functions
-
boolean(
{int min = 5, int max = 10, bool def = true}) → bool -
min
/max
probability will returndef
. -
capitalize(
String string) → String - capitalize the first letter of the word.
-
cfirst(
) → String - return a random chinses firstName.
-
character(
{List< String> pools = const [lower, upper], String self = ''}) → String - return a character from parameter.
-
city(
{bool splice = false}) → String - return a random chinese city.
-
clast(
) → String - return a random chinses lastName.
-
cname(
) → String - return a random chinses name.
-
county(
{bool splice = false}) → String - return a random chinese county.
-
cparagraph(
{int min = 3, int? max = 7}) → String - return a random chinese paragraph.
-
csentence(
{int min = 12, int? max = 18}) → String - return a random chinese sentence.
-
ctitle(
{int min = 3, int? max = 7}) → String - return a random chinese title.
-
cword(
{String pool = chineseCharacters, int min = 1, int? max}) → String - return a random chinese word.
-
dateTime(
{DateTime? start, DateTime? end}) → DateTime - return a random dateTime.
-
dateTimeString(
{DateTime? start, DateTime? end, String format = 'yyyy-MM-dd HH:mm:ss'}) → String - return a formatted random dateTime string.
-
domain(
{String? tld}) → String - return a random domain.
-
doubleR(
{int min = 0, int max = 1, int decimal = -1}) → double -
return a double between
min
tomax
. -
email(
{String? host}) → String - return a random email, example: esvhm@rkej.pg.
-
first(
) → String - return a random firstName.
-
guid(
) → String - return a random guid.
-
hex(
{bool alpha = true}) → String - return a hex color string, example: FFAABBCC.
-
hexValue(
) → int - return a 16 radix int, example: 4285062059.
-
idCard(
) → String - return a random chinese idCard.
-
image(
{String? size, String? background, String? foreground, ImageFormat? format, String? text}) → String - return a random image url.
-
integer(
{int min = 0, int max = maxInteger}) → int -
return an integer between
min
tomax
. -
ip(
) → String - return a random ip.
-
last(
) → String - return a random lastName.
-
name(
{bool middle = false}) → String - return a random english name.
-
paragraph(
{int min = 3, int? max = 7}) → String - return a random paragraph.
-
pick<
T> (List< T> list) → T - random pick a object from list.
-
protocol(
) → String - return a random protocol.
-
provice(
) → String - return a random chinese provice.
-
region(
) → String - return a random chinese region.
-
sentence(
{int min = 12, int? max = 18}) → String - return a random sentence, the first word capitalized.
-
string(
{List< String> pools = const [lower, upper, number, symbol], String self = '', int min = 5, int? max}) → String - return a string with random character.
-
title(
{int min = 3, int? max = 7}) → String - return a random title, all word capitalized.
-
tld(
) → String - return a random tld.
-
url(
{String? protocol, String? host}) → String - return a random domain.
-
word(
{int min = 3, int? max = 10}) → String - return a random word.
-
zip(
{int length = 6}) → String - return a random zip.