of method Null safety

ActionDispatcher of(
  1. BuildContext context
)

Returns the ActionDispatcher associated with the Actions widget that most tightly encloses the given BuildContext.

Will return a newly created ActionDispatcher if no ambient Actions widget is found.

Implementation

static ActionDispatcher of(BuildContext context) {
  assert(context != null);
  final _ActionsMarker? marker = context.dependOnInheritedWidgetOfExactType<_ActionsMarker>();
  return marker?.dispatcher ?? _findDispatcher(context);
}