parseAsync<O> function
Sink<String>
parseAsync<O>(
- AsyncResult<
O> parse(- State<
ChunkedParsingSink> state
- State<
- void onComplete(
- ParseResult<
ChunkedParsingSink, O> result
- ParseResult<
Implementation
Sink<String> parseAsync<O>(
AsyncResult<O> Function(State<ChunkedParsingSink> state) parse,
void Function(ParseResult<ChunkedParsingSink, O> result) onComplete) {
final input = ChunkedParsingSink();
final state = State(input);
final result = parse(state);
void complete() {
final parseResult =
_createParseResult<ChunkedParsingSink, O>(state, result.value);
onComplete(parseResult);
}
if (result.isComplete) {
complete();
} else {
result.onComplete = complete;
}
return input;
}