isCurrent property Null safety

bool isCurrent

Whether this route is the top-most route on the navigator.

If this is true, then isActive is also true.

Implementation

bool get isCurrent {
  if (_navigator == null) {
    return false;
  }
  final _RouteEntry? currentRouteEntry = _navigator!._history.cast<_RouteEntry?>().lastWhere(
    (_RouteEntry? e) => e != null && _RouteEntry.isPresentPredicate(e),
    orElse: () => null,
  );
  if (currentRouteEntry == null) {
    return false;
  }
  return currentRouteEntry.route == this;
}