12 lines
289 B
Dart
12 lines
289 B
Dart
/// 可空 List 扩展
|
|
extension ListNullableX on List? {
|
|
/// 长度,null 视为 0
|
|
int em() => this?.length ?? 0;
|
|
|
|
/// 是否为空(null 也视为空)
|
|
bool empty() => this == null || this!.isEmpty;
|
|
|
|
/// 是否非空
|
|
bool notEmpty() => this != null && this!.isNotEmpty;
|
|
}
|