maybeOf static method

HeroController? maybeOf(
  1. BuildContext context

Retrieves the HeroController from the closest HeroControllerScope ancestor, or null if none exists.

Calling this method will create a dependency on the closest HeroControllerScope in the context, if there is one.

See also:


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