mirror of
https://github.com/immich-app/immich.git
synced 2026-05-22 06:52:33 -04:00
12 lines
340 B
Dart
12 lines
340 B
Dart
extension OptionalCast on Object {
|
|
T? tryCast<T>() => this is T ? this as T : null;
|
|
}
|
|
|
|
extension NullUtilities on Object? {
|
|
/// Returns true if object is null or is empty
|
|
bool get isNullOrEmpty => (this == null || _isIterableAndEmpty);
|
|
|
|
bool get _isIterableAndEmpty =>
|
|
this is Iterable ? (this as Iterable).isEmpty : false;
|
|
}
|