use<T> method
Listen to a pod
, run the given cb
(which can return a Future),
then remove the listener once the cb
is complete.
Implementation
Future<T> use<T>(Pod<dynamic> pod, FutureOr<T> Function() cb) async {
final remove = mount(pod);
try {
return await cb();
} finally {
remove();
}
}