of<T extends EmpireViewModel> method
Null safety
- BuildContext context
Gets the instance of the EmpireApp that matches the generic type argument T
.
You can access the associated view model via the returned EmpireApp. However you'll most likely want to use the shorthand viewModelOf function to do so.
Implementation
static EmpireApp<T> of<T extends EmpireViewModel>(BuildContext context) {
final EmpireApp<T>? result =
context.dependOnInheritedWidgetOfExactType<EmpireApp<T>>();
assert(result != null, 'No Empire found in context');
return result!;
}