of method Null safety

HeroController? of(
  1. BuildContext context
)

Retrieves the HeroController from the closest HeroControllerScope ancestor.

Implementation

static HeroController? of(BuildContext context) {
  final HeroControllerScope? host = context.dependOnInheritedWidgetOfExactType<HeroControllerScope>();
  return host?.controller;
}