executeStream<S, E extends Object> method
- @protected
- FlutterRustBridgeTask<
S, E> task
inherited
Implementation
@protected
Stream<S> executeStream<S, E extends Object>(
FlutterRustBridgeTask<S, E> task) async* {
final func = task.constMeta.debugName;
final nextIndex = _streamSinkNameIndex.update(func, (value) => value + 1,
ifAbsent: () => 0);
final name = '__frb_streamsink_${func}_$nextIndex';
final receivePort = broadcastPort(name);
task.callFfi(receivePort.sendPort.nativePort);
await for (final raw in receivePort) {
try {
yield _transformRust2DartMessage(raw, task.parseSuccessData,
task.parseErrorData, wire2apiPanicError);
} on _CloseStreamException {
receivePort.close();
break;
}
}
}