build method

Widget build(
  1. BuildContext context
)

Implementation

Widget build(BuildContext context) {
  Map<Type, Branch> typesMap = _storage[this]!;

  return QueryBuilder<T>(builder: (context, state, child) {
    Branch? branch = typesMap[state.runtimeType];

    if (branch == null && typesMap[T] == null) {
      throw new Exception(
        'Neither ${state.runtimeType} or default case found',
      );
    }

    branch ??= typesMap[T]!;

    return branch.invoke(context, state);
  });
}