in lib/runtime/runtime.dart [95:122]
void invoke() async {
do {
NextInvocation nextInvocation;
try {
// get the next invocation
nextInvocation = await _client.getNextInvocation();
// creating the new context
final context = Context.fromNextInvocation(nextInvocation);
final func = _handlers[context.handler];
if(func == null) {
throw RuntimeException('No handler with name "${context.handler}" registered in runtime!');
}
final event =
Event.fromHandler(func.type, await nextInvocation.response);
final result = await func.handler(context, event);
await _client.postInvocationResponse(result);
} on Exception catch (error, stacktrace) {
await _client.postInvocationError(
nextInvocation.requestId, InvocationError(error, stacktrace));
}
nextInvocation = null;
} while (true);
}