mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refactor: rcmd hot
This commit is contained in:
@@ -13,3 +13,31 @@ extension ScrollControllerExt on ScrollController {
|
||||
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
|
||||
}
|
||||
}
|
||||
|
||||
extension ListExt<T> on List<T>? {
|
||||
bool get isNullOrEmpty => this == null || this!.isEmpty;
|
||||
|
||||
T? getOrNull(int index) {
|
||||
if (isNullOrEmpty) {
|
||||
return null;
|
||||
}
|
||||
return this![index];
|
||||
}
|
||||
|
||||
bool eq(List<T>? other) {
|
||||
if (this == null) {
|
||||
return other == null;
|
||||
}
|
||||
if (other == null || this!.length != other.length) {
|
||||
return false;
|
||||
}
|
||||
for (int index = 0; index < this!.length; index += 1) {
|
||||
if (this![index] != other[index]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ne(List<T>? other) => !eq(other);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user