fr method
Implementation
Future<Fr<T>> fr(DspReg disposers) async {
late _FwImpl<T> frw;
final seeded = Completer<void>();
late void Function(T value) listener;
listener = (value) {
frw = _FwImpl._(
value: (_) => value,
);
listener = frw.set;
seeded.complete(null);
};
final listening = listen((v) => listener(v));
disposers.add(() async {
await listening.cancel();
if (!seeded.isCompleted) {
seeded.completeError('disposed');
} else {
await frw.dispose();
}
});
await seeded.future;
return frw;
}