runQuery<TQuery extends IQuery<TResult> , TResult> method
Executes the given query if a handler for it could be found,
otherwise throws the StateError.
Implementation
Future<TResult> runQuery<TQuery extends IQuery<TResult>, TResult>(
TQuery query,
) async {
dynamic handler = _queryHandlers[TQuery];
if (handler == null) {
throw StateError(
"No query handler has been registered for the $TQuery type.",
);
}
IQueryHandler<TQuery, TResult> typedhandler = handler;
return await typedhandler.handle(query);
}