Repository: flutter/flutter
File: packages/flutter/lib/src/widgets/routes.dart (Dart)

Code before:
  /// while it is visible (specifically, if [isCurrent] or [canPop] change value).
  @optionalTypeArgs
  static ModalRoute<T>? of<T extends Object?>(BuildContext context) {
    return _of<T>(context);
  }

  static ModalRoute<T>? _of<T extends Object?>(BuildContext context, [_ModalRouteAspect? aspect]) {
    return InheritedModel.inheritFrom<_ModalScopeStatus>(context, aspect: aspect)?.route
        as ModalRoute<T>?;
  }

  /// Returns [ModalRoute.isCurrent] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Use of this method will cause the given [context] to rebuild any time that
  /// the [ModalRoute.isCurrent] property of the ancestor [_ModalScopeStatus] changes.
  static bool? isCurrentOf(BuildContext context) =>
      _of(context, _ModalRouteAspect.isCurrent)?.isCurrent;

  /// Returns [ModalRoute.canPop] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Use of this method will cause the given [context] to rebuild any time that
  /// the [ModalRoute.canPop] property of the ancestor [_ModalScopeStatus] changes.
  static bool? canPopOf(BuildContext context) => _of(context, _ModalRouteAspect.canPop)?.canPop;

  /// Returns [ModalRoute.settings] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Use of this method will cause the given [context] to rebuild any time that
  /// the [ModalRoute.settings] property of the ancestor [_ModalScopeStatus] changes.
  static RouteSettings? settingsOf(BuildContext context) =>
      _of(context, _ModalRouteAspect.settings)?.settings;

  /// Returns [ModalRoute.isActive] for the modal route most closely associated
  /// with the given context.
  static bool? isActiveOf(BuildContext context) =>
      _of(context, _ModalRouteAspect.isActive)?.isActive;

  /// Returns [ModalRoute.isFirst] for the modal route most closely associated
  /// with the given context.
  static bool? isFirstOf(BuildContext context) => _of(context, _ModalRouteAspect.isFirst)?.isFirst;

  /// Returns [ModalRoute.opaque] for the modal route most closely associated
  /// with the given context.

Review comment (suggestion):
I see that `settingsOf` and others above include a bit more in their docs, should you add them for the new parameters too?

```
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Use of this method will cause the given [context] to rebuild any time that
  /// the [ModalRoute.settings] property of the ancestor [_ModalScopeStatus] changes.
```

Code after:
  /// the [ModalRoute.isCurrent] property of the ancestor [_ModalScopeStatus] changes.
  static bool? isCurrentOf(BuildContext context) =>
      _of(context, _ModalRouteAspect.isCurrent)?.isCurrent;

  /// Returns [ModalRoute.canPop] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Use of this method will cause the given [context] to rebuild any time that
  /// the [ModalRoute.canPop] property of the ancestor [_ModalScopeStatus] changes.
  static bool? canPopOf(BuildContext context) => _of(context, _ModalRouteAspect.canPop)?.canPop;

  /// Returns [ModalRoute.settings] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Calling this method creates a dependency on the [ModalRoute] associated
  /// with the given [context]. As a result, the widget corresponding to [context]
  /// will be rebuilt whenever the route's [ModalRoute.settings] changes.
  static RouteSettings? settingsOf(BuildContext context) =>
      _of(context, _ModalRouteAspect.settings)?.settings;

  /// Returns [ModalRoute.isActive] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Calling this method creates a dependency on the [ModalRoute] associated
  /// with the given [context]. As a result, the widget corresponding to [context]
  /// will be rebuilt whenever the route's [ModalRoute.isActive] changes.
  static bool? isActiveOf(BuildContext context) =>
      _of(context, _ModalRouteAspect.isActive)?.isActive;

  /// Returns [ModalRoute.isFirst] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Calling this method creates a dependency on the [ModalRoute] associated
  /// with the given [context]. As a result, the widget corresponding to [context]
  /// will be rebuilt whenever the route's [ModalRoute.isFirst] changes.
  static bool? isFirstOf(BuildContext context) => _of(context, _ModalRouteAspect.isFirst)?.isFirst;

  /// Returns [ModalRoute.opaque] for the modal route most closely associated
  /// with the given context.
  ///
  /// Returns null if the given context is not associated with a modal route.
  ///
  /// Calling this method creates a dependency on the [ModalRoute] associated