model<T> method

T model<T>(
  1. Symbol key
)

Find the 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.
  • key The data key.

Implementation

T model<T>(Symbol key) {
  assert(state.mounted, 'State is not mounted');
  return Model.of<T>(state.context, key);
}