isFirst property Null safety

bool isFirst

Whether this route is the bottom-most active route on the navigator.

If isFirst and isCurrent are both true then this is the only route on the navigator (and isActive will also be true).

Implementation

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