1
0
Fork 0
mirror of https://gitlab.com/nkming2/nc-photos.git synced 2025-03-12 02:08:53 +01:00
nc-photos/lib/object_extension.dart

16 lines
288 B
Dart
Raw Normal View History

import 'dart:async';
extension ObjectExtension<T> on T {
T apply(void Function(T obj) fn) {
fn(this);
return this;
}
Future<T> applyFuture(FutureOr<void> Function(T obj) fn) async {
await fn(this);
return this;
}
2021-12-05 12:03:59 +01:00
U run<U>(U Function(T obj) fn) => fn(this);
}