初始化
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/// 文本处理工具类
|
||||
class TextUtil {
|
||||
static bool isEmpty(String? text) {
|
||||
return (null == text || text.isEmpty);
|
||||
}
|
||||
|
||||
static bool isNotEmpty(String? text) {
|
||||
return (null != text && text.isNotEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
/// 解析后端下发的字符串数组:非数组(null/空串/对象/数字)一律给空数组,
|
||||
/// 数组内的 null 丢掉,非字符串元素转字符串
|
||||
List<String> parseStringList(dynamic value) {
|
||||
if (value is! List) return [];
|
||||
return value.where((e) => e != null).map((e) => e.toString()).toList();
|
||||
}
|
||||
Reference in New Issue
Block a user