of<T extends Object?> static method

  1. @optionalTypeArgs
ModalRoute<T>? of<T extends Object?>(
  1. BuildContext context
)

Returns the modal route most closely associated with the given context.

Returns null if the given context is not associated with a modal route.

Typical usage is as follows:
link
ModalRoute<int>? route = ModalRoute.of<int>(context);

The given BuildContext will be rebuilt if the state of the route changes while it is visible (specifically, if isCurrent or canPop change value).

Implementation

@optionalTypeArgs
static ModalRoute<T>? of<T extends Object?>(BuildContext context) {
  return _of<T>(context);
}