nc-photos/app/lib/object_extension.dart

17 lines
480 B
Dart
Raw Normal View History

import 'dart:async';
2023-10-03 22:28:35 +08:00
import 'package:np_common/object_util.dart';
extension ObjectExtension<T> on T {
2023-10-03 22:28:35 +08:00
/// Deprecated, use [also]
T apply(void Function(T obj) fn) => also(fn);
2023-10-03 22:28:35 +08:00
/// Deprecated, use [alsoFuture]
Future<T> applyFuture(FutureOr<void> Function(T obj) fn) => alsoFuture(fn);
2021-12-05 19:03:59 +08:00
2023-10-03 22:28:35 +08:00
/// Deprecated, use [let]
U run<U>(U Function(T obj) fn) => let(fn);
2023-10-03 22:28:35 +08:00
/// Deprecated, use [letFuture]
Future<U> runFuture<U>(FutureOr<U> Function(T obj) fn) => letFuture(fn);
}