findRoot<T> static method

T findRoot<T>(
  1. BuildContext context
)

Find the root data of the given type from the context. Throws an assertion error if the data is not found.

  • T The type of the data.
  • context The build context.

Implementation

static T findRoot<T>(BuildContext context) {
  final data = maybeFindRoot<T>(context);
  assert(data != null, 'No Data<$T> found in context');
  return data!;
}