mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-16 14:14:01 +08:00
tweaks (#2100)
* mod: pgc episode title * opt: ColorScheme.of * mod: mpv api version * opt: log handler * opt: ext
This commit is contained in:
committed by
GitHub
parent
24769e144f
commit
b33fdf14af
@@ -1,11 +1,8 @@
|
||||
import 'dart:io' show FileSystemEntity, Directory;
|
||||
|
||||
extension FileSystemEntityExt on FileSystemEntity {
|
||||
Future<void> tryDel({bool recursive = false}) async {
|
||||
try {
|
||||
await delete(recursive: recursive);
|
||||
} catch (_) {}
|
||||
}
|
||||
Future<void> tryDel({bool recursive = false}) =>
|
||||
delete(recursive: recursive).catchError((_) => this);
|
||||
}
|
||||
|
||||
extension DirectoryExt on Directory {
|
||||
|
||||
@@ -14,13 +14,6 @@ extension IterableExt<T> on Iterable<T> {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
T? firstWhereOrNull(bool Function(T element) test) {
|
||||
for (final element in this) {
|
||||
if (test(element)) return element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
extension ListExt<T> on List<T> {
|
||||
@@ -69,6 +62,6 @@ extension ListExt<T> on List<T> {
|
||||
|
||||
T? getOrNull(int index) {
|
||||
if (index < 0 || index >= length) return null;
|
||||
return elementAt(index);
|
||||
return this[index];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user