RandomUtils class

随机工具类

Constructors

RandomUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

condenseWhiteSpace(String str) String
Cleans up provided string by removing extra whitespace. 通过删除额外的空格来清理提供的字符串
isWhiteSpaceOrEmptyOrNull(String str) bool
Returns true for for all strings that are empty, null or only whitespace. 对于所有为空、空或只有空格的字符串返回true。
randInt(int end, {int start = 0}) int
Generate a random number between start and end inclusive. 在开始和结束之间生成一个随机数
randomColor() int
Generates a random integer that represents a Hex color. 生成一个表示十六进制颜色的随机整数
randomElement<T>(List<T> items) → T?
从列表中返回一个随机元素。
randomString({int? length}) String
Generates a random string of provided or random length. 生成指定长度或随机长度的随机字符串
removeNonDigits(String str) String
Extracts decimal numbers from the provided string. 从提供的字符串中提取十进制数。
removeWhiteSpace(String str) String
Removes all whitespace from provided string. 从提供的字符串中删除所有空格。