CommonUtil class
通用工具类 提供一些常用的通用方法
Constructors
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
-
copy(
String text) → dynamic - 复制文本 @param text 文本
-
fillSpaceStr(
List< String> strs) → List<String> - 字符串数组,填充空格保持字符串长度一致
-
randomColor(
) → Color - 生成随机色
-
randomColorInRange(
Color baseColor, {double variation = 0.2}) → Color -
baseColor基础颜色variation变化范围 0.0-1.0 -
randomIndexByWeight(
List< double> weights) → int - 使用累积概率法根据权重获取随机索引 使用示例:
-
randomInt(
int min, int max) → int - 获取随机数 @param min 最小值 @param max 最大值