Unverified Commit 77504823 authored by Ren You's avatar Ren You Committed by GitHub

Revert "Replace some `dynamic` to `Object?` type (#80772)" (#80965)

This reverts commit 12a2e682.
parent 523c812b
...@@ -789,7 +789,7 @@ class _AppBarState extends State<AppBar> { ...@@ -789,7 +789,7 @@ class _AppBarState extends State<AppBar> {
final ColorScheme colorScheme = theme.colorScheme; final ColorScheme colorScheme = theme.colorScheme;
final AppBarTheme appBarTheme = AppBarTheme.of(context); final AppBarTheme appBarTheme = AppBarTheme.of(context);
final ScaffoldState? scaffold = Scaffold.maybeOf(context); final ScaffoldState? scaffold = Scaffold.maybeOf(context);
final ModalRoute<Object?>? parentRoute = ModalRoute.of(context); final ModalRoute<dynamic>? parentRoute = ModalRoute.of(context);
final FlexibleSpaceBarSettings? settings = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>(); final FlexibleSpaceBarSettings? settings = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
final Set<MaterialState> states = <MaterialState>{ final Set<MaterialState> states = <MaterialState>{
...@@ -799,7 +799,7 @@ class _AppBarState extends State<AppBar> { ...@@ -799,7 +799,7 @@ class _AppBarState extends State<AppBar> {
final bool hasDrawer = scaffold?.hasDrawer ?? false; final bool hasDrawer = scaffold?.hasDrawer ?? false;
final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false; final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false;
final bool canPop = parentRoute?.canPop ?? false; final bool canPop = parentRoute?.canPop ?? false;
final bool useCloseButton = parentRoute is PageRoute<Object?> && parentRoute.fullscreenDialog; final bool useCloseButton = parentRoute is PageRoute<dynamic> && parentRoute.fullscreenDialog;
final double toolbarHeight = widget.toolbarHeight ?? appBarTheme.toolbarHeight ?? kToolbarHeight; final double toolbarHeight = widget.toolbarHeight ?? appBarTheme.toolbarHeight ?? kToolbarHeight;
final bool backwardsCompatibility = widget.backwardsCompatibility ?? appBarTheme.backwardsCompatibility ?? true; final bool backwardsCompatibility = widget.backwardsCompatibility ?? appBarTheme.backwardsCompatibility ?? true;
......
...@@ -363,7 +363,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -363,7 +363,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
void _ensureHistoryEntry() { void _ensureHistoryEntry() {
if (_historyEntry == null) { if (_historyEntry == null) {
final ModalRoute<Object?>? route = ModalRoute.of(context); final ModalRoute<dynamic>? route = ModalRoute.of(context);
if (route != null) { if (route != null) {
_historyEntry = LocalHistoryEntry(onRemove: _handleHistoryEntryRemoved); _historyEntry = LocalHistoryEntry(onRemove: _handleHistoryEntryRemoved);
route.addLocalHistoryEntry(_historyEntry!); route.addLocalHistoryEntry(_historyEntry!);
......
...@@ -452,7 +452,7 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide ...@@ -452,7 +452,7 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
_accessibleNavigation = mediaQuery.accessibleNavigation; _accessibleNavigation = mediaQuery.accessibleNavigation;
if (_snackBars.isNotEmpty) { if (_snackBars.isNotEmpty) {
final ModalRoute<Object?>? route = ModalRoute.of(context); final ModalRoute<dynamic>? route = ModalRoute.of(context);
if (route == null || route.isCurrent) { if (route == null || route.isCurrent) {
if (_snackBarController!.isCompleted && _snackBarTimer == null) { if (_snackBarController!.isCompleted && _snackBarTimer == null) {
final SnackBar snackBar = _snackBars.first._widget; final SnackBar snackBar = _snackBars.first._widget;
...@@ -2408,7 +2408,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto ...@@ -2408,7 +2408,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
// Important if the app/user takes an action that could repeatedly show a // Important if the app/user takes an action that could repeatedly show a
// bottom sheet. // bottom sheet.
final List<_StandardBottomSheet> _dismissedBottomSheets = <_StandardBottomSheet>[]; final List<_StandardBottomSheet> _dismissedBottomSheets = <_StandardBottomSheet>[];
PersistentBottomSheetController<Object?>? _currentBottomSheet; PersistentBottomSheetController<dynamic>? _currentBottomSheet;
final GlobalKey _currentBottomSheetKey = GlobalKey(); final GlobalKey _currentBottomSheetKey = GlobalKey();
void _maybeBuildPersistentBottomSheet() { void _maybeBuildPersistentBottomSheet() {
...@@ -2985,7 +2985,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto ...@@ -2985,7 +2985,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
// TODO(Piinks): Remove old SnackBar API after migrating ScaffoldMessenger // TODO(Piinks): Remove old SnackBar API after migrating ScaffoldMessenger
_accessibleNavigation = mediaQuery.accessibleNavigation; _accessibleNavigation = mediaQuery.accessibleNavigation;
if (_snackBars.isNotEmpty) { if (_snackBars.isNotEmpty) {
final ModalRoute<Object?>? route = ModalRoute.of(context); final ModalRoute<dynamic>? route = ModalRoute.of(context);
if (route == null || route.isCurrent) { if (route == null || route.isCurrent) {
if (_snackBarController!.isCompleted && _snackBarTimer == null) { if (_snackBarController!.isCompleted && _snackBarTimer == null) {
final SnackBar snackBar = _snackBars.first._widget; final SnackBar snackBar = _snackBars.first._widget;
......
...@@ -487,8 +487,8 @@ class _HeroFlightManifest { ...@@ -487,8 +487,8 @@ class _HeroFlightManifest {
final HeroFlightDirection type; final HeroFlightDirection type;
final OverlayState overlay; final OverlayState overlay;
final Size navigatorSize; final Size navigatorSize;
final PageRoute<Object?> fromRoute; final PageRoute<dynamic> fromRoute;
final PageRoute<Object?> toRoute; final PageRoute<dynamic> toRoute;
final _HeroState fromHero; final _HeroState fromHero;
final _HeroState toHero; final _HeroState toHero;
final CreateRectTween? createRectTween; final CreateRectTween? createRectTween;
...@@ -830,14 +830,14 @@ class HeroController extends NavigatorObserver { ...@@ -830,14 +830,14 @@ class HeroController extends NavigatorObserver {
final Map<Object, _HeroFlight> _flights = <Object, _HeroFlight>{}; final Map<Object, _HeroFlight> _flights = <Object, _HeroFlight>{};
@override @override
void didPush(Route<Object?> route, Route<Object?>? previousRoute) { void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
assert(navigator != null); assert(navigator != null);
assert(route != null); assert(route != null);
_maybeStartHeroTransition(previousRoute, route, HeroFlightDirection.push, false); _maybeStartHeroTransition(previousRoute, route, HeroFlightDirection.push, false);
} }
@override @override
void didPop(Route<Object?> route, Route<Object?>? previousRoute) { void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
assert(navigator != null); assert(navigator != null);
assert(route != null); assert(route != null);
// Don't trigger another flight when a pop is committed as a user gesture // Don't trigger another flight when a pop is committed as a user gesture
...@@ -847,7 +847,7 @@ class HeroController extends NavigatorObserver { ...@@ -847,7 +847,7 @@ class HeroController extends NavigatorObserver {
} }
@override @override
void didReplace({ Route<Object?>? newRoute, Route<Object?>? oldRoute }) { void didReplace({ Route<dynamic>? newRoute, Route<dynamic>? oldRoute }) {
assert(navigator != null); assert(navigator != null);
if (newRoute?.isCurrent == true) { if (newRoute?.isCurrent == true) {
// Only run hero animations if the top-most route got replaced. // Only run hero animations if the top-most route got replaced.
...@@ -856,7 +856,7 @@ class HeroController extends NavigatorObserver { ...@@ -856,7 +856,7 @@ class HeroController extends NavigatorObserver {
} }
@override @override
void didStartUserGesture(Route<Object?> route, Route<Object?>? previousRoute) { void didStartUserGesture(Route<dynamic> route, Route<dynamic>? previousRoute) {
assert(navigator != null); assert(navigator != null);
assert(route != null); assert(route != null);
_maybeStartHeroTransition(route, previousRoute, HeroFlightDirection.pop, true); _maybeStartHeroTransition(route, previousRoute, HeroFlightDirection.pop, true);
...@@ -892,14 +892,14 @@ class HeroController extends NavigatorObserver { ...@@ -892,14 +892,14 @@ class HeroController extends NavigatorObserver {
// If we're transitioning between different page routes, start a hero transition // If we're transitioning between different page routes, start a hero transition
// after the toRoute has been laid out with its animation's value at 1.0. // after the toRoute has been laid out with its animation's value at 1.0.
void _maybeStartHeroTransition( void _maybeStartHeroTransition(
Route<Object?>? fromRoute, Route<dynamic>? fromRoute,
Route<Object?>? toRoute, Route<dynamic>? toRoute,
HeroFlightDirection flightType, HeroFlightDirection flightType,
bool isUserGestureTransition, bool isUserGestureTransition,
) { ) {
if (toRoute != fromRoute && toRoute is PageRoute<Object?> && fromRoute is PageRoute<Object?>) { if (toRoute != fromRoute && toRoute is PageRoute<dynamic> && fromRoute is PageRoute<dynamic>) {
final PageRoute<Object?> from = fromRoute; final PageRoute<dynamic> from = fromRoute;
final PageRoute<Object?> to = toRoute; final PageRoute<dynamic> to = toRoute;
final Animation<double> animation = (flightType == HeroFlightDirection.push) ? to.animation! : from.animation!; final Animation<double> animation = (flightType == HeroFlightDirection.push) ? to.animation! : from.animation!;
// A user gesture may have already completed the pop, or we might be the initial route // A user gesture may have already completed the pop, or we might be the initial route
...@@ -940,8 +940,8 @@ class HeroController extends NavigatorObserver { ...@@ -940,8 +940,8 @@ class HeroController extends NavigatorObserver {
// Find the matching pairs of heroes in from and to and either start or a new // Find the matching pairs of heroes in from and to and either start or a new
// hero flight, or divert an existing one. // hero flight, or divert an existing one.
void _startHeroTransition( void _startHeroTransition(
PageRoute<Object?> from, PageRoute<dynamic> from,
PageRoute<Object?> to, PageRoute<dynamic> to,
Animation<double> animation, Animation<double> animation,
HeroFlightDirection flightType, HeroFlightDirection flightType,
bool isUserGestureTransition, bool isUserGestureTransition,
......
...@@ -38,12 +38,12 @@ import 'ticker_provider.dart'; ...@@ -38,12 +38,12 @@ import 'ticker_provider.dart';
/// See also: /// See also:
/// ///
/// * [Navigator], which is where all the [Route]s end up. /// * [Navigator], which is where all the [Route]s end up.
typedef RouteFactory = Route<Object?>? Function(RouteSettings settings); typedef RouteFactory = Route<dynamic>? Function(RouteSettings settings);
/// Creates a series of one or more routes. /// Creates a series of one or more routes.
/// ///
/// Used by [Navigator.onGenerateInitialRoutes]. /// Used by [Navigator.onGenerateInitialRoutes].
typedef RouteListFactory = List<Route<Object?>> Function(NavigatorState navigator, String initialRoute); typedef RouteListFactory = List<Route<dynamic>> Function(NavigatorState navigator, String initialRoute);
/// Creates a [Route] that is to be added to a [Navigator]. /// Creates a [Route] that is to be added to a [Navigator].
/// ///
...@@ -58,7 +58,7 @@ typedef RouteListFactory = List<Route<Object?>> Function(NavigatorState navigato ...@@ -58,7 +58,7 @@ typedef RouteListFactory = List<Route<Object?>> Function(NavigatorState navigato
typedef RestorableRouteBuilder<T> = Route<T> Function(BuildContext context, Object? arguments); typedef RestorableRouteBuilder<T> = Route<T> Function(BuildContext context, Object? arguments);
/// Signature for the [Navigator.popUntil] predicate argument. /// Signature for the [Navigator.popUntil] predicate argument.
typedef RoutePredicate = bool Function(Route<Object?> route); typedef RoutePredicate = bool Function(Route<dynamic> route);
/// Signature for a callback that verifies that it's OK to call [Navigator.pop]. /// Signature for a callback that verifies that it's OK to call [Navigator.pop].
/// ///
...@@ -73,7 +73,7 @@ typedef WillPopCallback = Future<bool> Function(); ...@@ -73,7 +73,7 @@ typedef WillPopCallback = Future<bool> Function();
/// [Navigator.pages] so that it no longer includes the corresponding [Page]. /// [Navigator.pages] so that it no longer includes the corresponding [Page].
/// (Otherwise, the page will be interpreted as a new page to show when the /// (Otherwise, the page will be interpreted as a new page to show when the
/// [Navigator.pages] list is next updated.) /// [Navigator.pages] list is next updated.)
typedef PopPageCallback = bool Function(Route<Object?> route, Object? result); typedef PopPageCallback = bool Function(Route<dynamic> route, dynamic result);
/// Indicates whether the current route should be popped. /// Indicates whether the current route should be popped.
/// ///
...@@ -260,7 +260,7 @@ abstract class Route<T> { ...@@ -260,7 +260,7 @@ abstract class Route<T> {
/// immediately after this method is called. /// immediately after this method is called.
@protected @protected
@mustCallSuper @mustCallSuper
void didReplace(Route<Object?>? oldRoute) { } void didReplace(Route<dynamic>? oldRoute) { }
/// Returns whether calling [Navigator.maybePop] when this [Route] is current /// Returns whether calling [Navigator.maybePop] when this [Route] is current
/// ([isCurrent]) should do anything. /// ([isCurrent]) should do anything.
...@@ -362,7 +362,7 @@ abstract class Route<T> { ...@@ -362,7 +362,7 @@ abstract class Route<T> {
/// is no next route. /// is no next route.
@protected @protected
@mustCallSuper @mustCallSuper
void didPopNext(Route<Object?> nextRoute) { } void didPopNext(Route<dynamic> nextRoute) { }
/// This route's next route has changed to the given new route. /// This route's next route has changed to the given new route.
/// ///
...@@ -375,7 +375,7 @@ abstract class Route<T> { ...@@ -375,7 +375,7 @@ abstract class Route<T> {
/// if [isCurrent] is true). /// if [isCurrent] is true).
@protected @protected
@mustCallSuper @mustCallSuper
void didChangeNext(Route<Object?>? nextRoute) { } void didChangeNext(Route<dynamic>? nextRoute) { }
/// This route's previous route has changed to the given new route. /// This route's previous route has changed to the given new route.
/// ///
...@@ -388,7 +388,7 @@ abstract class Route<T> { ...@@ -388,7 +388,7 @@ abstract class Route<T> {
/// (i.e. if [isFirst] is true). /// (i.e. if [isFirst] is true).
@protected @protected
@mustCallSuper @mustCallSuper
void didChangePrevious(Route<Object?>? previousRoute) { } void didChangePrevious(Route<dynamic>? previousRoute) { }
/// Called whenever the internal state of the route has changed. /// Called whenever the internal state of the route has changed.
/// ///
...@@ -588,7 +588,7 @@ abstract class Page<T> extends RouteSettings { ...@@ -588,7 +588,7 @@ abstract class Page<T> extends RouteSettings {
/// ///
/// Two pages are consider updatable if they have same the [runtimeType] and /// Two pages are consider updatable if they have same the [runtimeType] and
/// [key]. /// [key].
bool canUpdate(Page<Object?> other) { bool canUpdate(Page<dynamic> other) {
return other.runtimeType == runtimeType && return other.runtimeType == runtimeType &&
other.key == key; other.key == key;
} }
...@@ -613,13 +613,13 @@ class NavigatorObserver { ...@@ -613,13 +613,13 @@ class NavigatorObserver {
/// ///
/// The route immediately below that one, and thus the previously active /// The route immediately below that one, and thus the previously active
/// route, is `previousRoute`. /// route, is `previousRoute`.
void didPush(Route<Object?> route, Route<Object?>? previousRoute) { } void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) { }
/// The [Navigator] popped `route`. /// The [Navigator] popped `route`.
/// ///
/// The route immediately below that one, and thus the newly active /// The route immediately below that one, and thus the newly active
/// route, is `previousRoute`. /// route, is `previousRoute`.
void didPop(Route<Object?> route, Route<Object?>? previousRoute) { } void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) { }
/// The [Navigator] removed `route`. /// The [Navigator] removed `route`.
/// ///
...@@ -630,16 +630,16 @@ class NavigatorObserver { ...@@ -630,16 +630,16 @@ class NavigatorObserver {
/// bottommost route being removed, if any, is `previousRoute`, and this /// bottommost route being removed, if any, is `previousRoute`, and this
/// method will be called once for each removed route, from the topmost route /// method will be called once for each removed route, from the topmost route
/// to the bottommost route. /// to the bottommost route.
void didRemove(Route<Object?> route, Route<Object?>? previousRoute) { } void didRemove(Route<dynamic> route, Route<dynamic>? previousRoute) { }
/// The [Navigator] replaced `oldRoute` with `newRoute`. /// The [Navigator] replaced `oldRoute` with `newRoute`.
void didReplace({ Route<Object?>? newRoute, Route<Object?>? oldRoute }) { } void didReplace({ Route<dynamic>? newRoute, Route<dynamic>? oldRoute }) { }
/// The [Navigator]'s routes are being moved by a user gesture. /// The [Navigator]'s routes are being moved by a user gesture.
/// ///
/// For example, this is called when an iOS back gesture starts, and is used /// For example, this is called when an iOS back gesture starts, and is used
/// to disabled hero animations during such interactions. /// to disabled hero animations during such interactions.
void didStartUserGesture(Route<Object?> route, Route<Object?>? previousRoute) { } void didStartUserGesture(Route<dynamic> route, Route<dynamic>? previousRoute) { }
/// User gesture is no longer controlling the [Navigator]. /// User gesture is no longer controlling the [Navigator].
/// ///
...@@ -694,7 +694,7 @@ class HeroControllerScope extends InheritedWidget { ...@@ -694,7 +694,7 @@ class HeroControllerScope extends InheritedWidget {
/// decide how its underlying [Route] should transition on or off screen. /// decide how its underlying [Route] should transition on or off screen.
abstract class RouteTransitionRecord { abstract class RouteTransitionRecord {
/// Retrieves the wrapped [Route]. /// Retrieves the wrapped [Route].
Route<Object?> get route; Route<dynamic> get route;
/// Whether this route is waiting for the decision on how to enter the screen. /// Whether this route is waiting for the decision on how to enter the screen.
/// ///
...@@ -729,14 +729,14 @@ abstract class RouteTransitionRecord { ...@@ -729,14 +729,14 @@ abstract class RouteTransitionRecord {
/// During [TransitionDelegate.resolve], this can be called on an exiting /// During [TransitionDelegate.resolve], this can be called on an exiting
/// route to indicate that the route should be popped off the [Navigator] with /// route to indicate that the route should be popped off the [Navigator] with
/// an animated transition. /// an animated transition.
void markForPop([Object? result]); void markForPop([dynamic result]);
/// Marks the [route] to be completed without transition. /// Marks the [route] to be completed without transition.
/// ///
/// During [TransitionDelegate.resolve], this can be called on an exiting /// During [TransitionDelegate.resolve], this can be called on an exiting
/// route to indicate that the route should be completed with the provided /// route to indicate that the route should be completed with the provided
/// result and removed from the [Navigator] without an animated transition. /// result and removed from the [Navigator] without an animated transition.
void markForComplete([Object? result]); void markForComplete([dynamic result]);
/// Marks the [route] to be removed without transition. /// Marks the [route] to be removed without transition.
/// ///
...@@ -1467,13 +1467,13 @@ class Navigator extends StatefulWidget { ...@@ -1467,13 +1467,13 @@ class Navigator extends StatefulWidget {
/// If the [pages] is not empty, the [onPopPage] must not be null. /// If the [pages] is not empty, the [onPopPage] must not be null.
const Navigator({ const Navigator({
Key? key, Key? key,
this.pages = const <Page<Object?>>[], this.pages = const <Page<dynamic>>[],
this.onPopPage, this.onPopPage,
this.initialRoute, this.initialRoute,
this.onGenerateInitialRoutes = Navigator.defaultGenerateInitialRoutes, this.onGenerateInitialRoutes = Navigator.defaultGenerateInitialRoutes,
this.onGenerateRoute, this.onGenerateRoute,
this.onUnknownRoute, this.onUnknownRoute,
this.transitionDelegate = const DefaultTransitionDelegate<Object?>(), this.transitionDelegate = const DefaultTransitionDelegate<dynamic>(),
this.reportsRouteUpdateToEngine = false, this.reportsRouteUpdateToEngine = false,
this.observers = const <NavigatorObserver>[], this.observers = const <NavigatorObserver>[],
this.restorationScopeId, this.restorationScopeId,
...@@ -1512,7 +1512,7 @@ class Navigator extends StatefulWidget { ...@@ -1512,7 +1512,7 @@ class Navigator extends StatefulWidget {
/// If [initialRoute] is non-null when the widget is first created, then /// If [initialRoute] is non-null when the widget is first created, then
/// [onGenerateInitialRoutes] is used to generate routes that are above those /// [onGenerateInitialRoutes] is used to generate routes that are above those
/// corresponding to [pages] in the initial history. /// corresponding to [pages] in the initial history.
final List<Page<Object?>> pages; final List<Page<dynamic>> pages;
/// Called when [pop] is invoked but the current [Route] corresponds to a /// Called when [pop] is invoked but the current [Route] corresponds to a
/// [Page] found in the [pages] list. /// [Page] found in the [pages] list.
...@@ -1533,7 +1533,7 @@ class Navigator extends StatefulWidget { ...@@ -1533,7 +1533,7 @@ class Navigator extends StatefulWidget {
/// during the [pages] updates. /// during the [pages] updates.
/// ///
/// Defaults to [DefaultTransitionDelegate] if not specified, cannot be null. /// Defaults to [DefaultTransitionDelegate] if not specified, cannot be null.
final TransitionDelegate<Object?> transitionDelegate; final TransitionDelegate<dynamic> transitionDelegate;
/// The name of the first route to show. /// The name of the first route to show.
/// ///
...@@ -1994,7 +1994,7 @@ class Navigator extends StatefulWidget { ...@@ -1994,7 +1994,7 @@ class Navigator extends StatefulWidget {
/// [RoutePredicate] returned from [ModalRoute.withName]. /// [RoutePredicate] returned from [ModalRoute.withName].
/// ///
/// To remove all the routes below the pushed route, use a [RoutePredicate] /// To remove all the routes below the pushed route, use a [RoutePredicate]
/// that always returns false (e.g. `(Route<Object?> route) => false`). /// that always returns false (e.g. `(Route<dynamic> route) => false`).
/// ///
/// The removed routes are removed without being completed, so this method /// The removed routes are removed without being completed, so this method
/// does not take a return value argument. /// does not take a return value argument.
...@@ -2297,7 +2297,7 @@ class Navigator extends StatefulWidget { ...@@ -2297,7 +2297,7 @@ class Navigator extends StatefulWidget {
/// [RoutePredicate] returned from [ModalRoute.withName]. /// [RoutePredicate] returned from [ModalRoute.withName].
/// ///
/// To remove all the routes below the pushed route, use a [RoutePredicate] /// To remove all the routes below the pushed route, use a [RoutePredicate]
/// that always returns false (e.g. `(Route<Object?> route) => false`). /// that always returns false (e.g. `(Route<dynamic> route) => false`).
/// ///
/// The removed routes are removed without being completed, so this method /// The removed routes are removed without being completed, so this method
/// does not take a return value argument. /// does not take a return value argument.
...@@ -2429,7 +2429,7 @@ class Navigator extends StatefulWidget { ...@@ -2429,7 +2429,7 @@ class Navigator extends StatefulWidget {
/// * [restorableReplace], which adds a replacement route that can be /// * [restorableReplace], which adds a replacement route that can be
/// restored during state restoration. /// restored during state restoration.
@optionalTypeArgs @optionalTypeArgs
static void replace<T extends Object?>(BuildContext context, { required Route<Object?> oldRoute, required Route<T> newRoute }) { static void replace<T extends Object?>(BuildContext context, { required Route<dynamic> oldRoute, required Route<T> newRoute }) {
return Navigator.of(context).replace<T>(oldRoute: oldRoute, newRoute: newRoute); return Navigator.of(context).replace<T>(oldRoute: oldRoute, newRoute: newRoute);
} }
...@@ -2448,7 +2448,7 @@ class Navigator extends StatefulWidget { ...@@ -2448,7 +2448,7 @@ class Navigator extends StatefulWidget {
/// ///
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue} /// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
@optionalTypeArgs @optionalTypeArgs
static String restorableReplace<T extends Object?>(BuildContext context, { required Route<Object?> oldRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) { static String restorableReplace<T extends Object?>(BuildContext context, { required Route<dynamic> oldRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) {
return Navigator.of(context).restorableReplace<T>(oldRoute: oldRoute, newRouteBuilder: newRouteBuilder, arguments: arguments); return Navigator.of(context).restorableReplace<T>(oldRoute: oldRoute, newRouteBuilder: newRouteBuilder, arguments: arguments);
} }
...@@ -2484,7 +2484,7 @@ class Navigator extends StatefulWidget { ...@@ -2484,7 +2484,7 @@ class Navigator extends StatefulWidget {
/// * [restorableReplaceRouteBelow], which adds a replacement route that can /// * [restorableReplaceRouteBelow], which adds a replacement route that can
/// be restored during state restoration. /// be restored during state restoration.
@optionalTypeArgs @optionalTypeArgs
static void replaceRouteBelow<T extends Object?>(BuildContext context, { required Route<Object?> anchorRoute, required Route<T> newRoute }) { static void replaceRouteBelow<T extends Object?>(BuildContext context, { required Route<dynamic> anchorRoute, required Route<T> newRoute }) {
return Navigator.of(context).replaceRouteBelow<T>(anchorRoute: anchorRoute, newRoute: newRoute); return Navigator.of(context).replaceRouteBelow<T>(anchorRoute: anchorRoute, newRoute: newRoute);
} }
...@@ -2504,7 +2504,7 @@ class Navigator extends StatefulWidget { ...@@ -2504,7 +2504,7 @@ class Navigator extends StatefulWidget {
/// ///
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue} /// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
@optionalTypeArgs @optionalTypeArgs
static String restorableReplaceRouteBelow<T extends Object?>(BuildContext context, { required Route<Object?> anchorRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) { static String restorableReplaceRouteBelow<T extends Object?>(BuildContext context, { required Route<dynamic> anchorRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) {
return Navigator.of(context).restorableReplaceRouteBelow<T>(anchorRoute: anchorRoute, newRouteBuilder: newRouteBuilder, arguments: arguments); return Navigator.of(context).restorableReplaceRouteBelow<T>(anchorRoute: anchorRoute, newRouteBuilder: newRouteBuilder, arguments: arguments);
} }
...@@ -2548,7 +2548,7 @@ class Navigator extends StatefulWidget { ...@@ -2548,7 +2548,7 @@ class Navigator extends StatefulWidget {
/// Android it's called by the binding for the system's back button. /// Android it's called by the binding for the system's back button.
/// ///
/// The `T` type argument is the type of the return value of the current /// The `T` type argument is the type of the return value of the current
/// route. (Typically this isn't known; consider specifying `Object?` or /// route. (Typically this isn't known; consider specifying `dynamic` or
/// `Null`.) /// `Null`.)
/// {@endtemplate} /// {@endtemplate}
/// ///
...@@ -2665,7 +2665,7 @@ class Navigator extends StatefulWidget { ...@@ -2665,7 +2665,7 @@ class Navigator extends StatefulWidget {
/// ///
/// This method is used, for example, to instantly dismiss dropdown menus that /// This method is used, for example, to instantly dismiss dropdown menus that
/// are up when the screen's orientation changes. /// are up when the screen's orientation changes.
static void removeRoute(BuildContext context, Route<Object?> route) { static void removeRoute(BuildContext context, Route<dynamic> route) {
return Navigator.of(context).removeRoute(route); return Navigator.of(context).removeRoute(route);
} }
...@@ -2690,7 +2690,7 @@ class Navigator extends StatefulWidget { ...@@ -2690,7 +2690,7 @@ class Navigator extends StatefulWidget {
/// ///
/// Ongoing gestures within the current route are canceled. /// Ongoing gestures within the current route are canceled.
/// {@endtemplate} /// {@endtemplate}
static void removeRouteBelow(BuildContext context, Route<Object?> anchorRoute) { static void removeRouteBelow(BuildContext context, Route<dynamic> anchorRoute) {
return Navigator.of(context).removeRouteBelow(anchorRoute); return Navigator.of(context).removeRouteBelow(anchorRoute);
} }
...@@ -2791,8 +2791,8 @@ class Navigator extends StatefulWidget { ...@@ -2791,8 +2791,8 @@ class Navigator extends StatefulWidget {
/// then the [Navigator] would push the following routes on startup: `/`, /// then the [Navigator] would push the following routes on startup: `/`,
/// `/stocks`, `/stocks/HOOLI`. This enables deep linking while allowing the /// `/stocks`, `/stocks/HOOLI`. This enables deep linking while allowing the
/// application to maintain a predictable route history. /// application to maintain a predictable route history.
static List<Route<Object?>> defaultGenerateInitialRoutes(NavigatorState navigator, String initialRouteName) { static List<Route<dynamic>> defaultGenerateInitialRoutes(NavigatorState navigator, String initialRouteName) {
final List<Route<Object?>?> result = <Route<Object?>?>[]; final List<Route<dynamic>?> result = <Route<dynamic>?>[];
if (initialRouteName.startsWith('/') && initialRouteName.length > 1) { if (initialRouteName.startsWith('/') && initialRouteName.length > 1) {
initialRouteName = initialRouteName.substring(1); // strip leading '/' initialRouteName = initialRouteName.substring(1); // strip leading '/'
assert(Navigator.defaultRouteName == '/'); assert(Navigator.defaultRouteName == '/');
...@@ -2801,7 +2801,7 @@ class Navigator extends StatefulWidget { ...@@ -2801,7 +2801,7 @@ class Navigator extends StatefulWidget {
debugRouteNames = <String>[ Navigator.defaultRouteName ]; debugRouteNames = <String>[ Navigator.defaultRouteName ];
return true; return true;
}()); }());
result.add(navigator._routeNamed<Object?>(Navigator.defaultRouteName, arguments: null, allowNull: true)); result.add(navigator._routeNamed<dynamic>(Navigator.defaultRouteName, arguments: null, allowNull: true));
final List<String> routeParts = initialRouteName.split('/'); final List<String> routeParts = initialRouteName.split('/');
if (initialRouteName.isNotEmpty) { if (initialRouteName.isNotEmpty) {
String routeName = ''; String routeName = '';
...@@ -2811,7 +2811,7 @@ class Navigator extends StatefulWidget { ...@@ -2811,7 +2811,7 @@ class Navigator extends StatefulWidget {
debugRouteNames!.add(routeName); debugRouteNames!.add(routeName);
return true; return true;
}()); }());
result.add(navigator._routeNamed<Object?>(routeName, arguments: null, allowNull: true)); result.add(navigator._routeNamed<dynamic>(routeName, arguments: null, allowNull: true));
} }
} }
if (result.last == null) { if (result.last == null) {
...@@ -2832,7 +2832,7 @@ class Navigator extends StatefulWidget { ...@@ -2832,7 +2832,7 @@ class Navigator extends StatefulWidget {
} else if (initialRouteName != Navigator.defaultRouteName) { } else if (initialRouteName != Navigator.defaultRouteName) {
// If initialRouteName wasn't '/', then we try to get it with allowNull:true, so that if that fails, // If initialRouteName wasn't '/', then we try to get it with allowNull:true, so that if that fails,
// we fall back to '/' (without allowNull:true, see below). // we fall back to '/' (without allowNull:true, see below).
result.add(navigator._routeNamed<Object?>(initialRouteName, arguments: null, allowNull: true)); result.add(navigator._routeNamed<dynamic>(initialRouteName, arguments: null, allowNull: true));
} }
// Null route might be a result of gap in initialRouteName // Null route might be a result of gap in initialRouteName
// //
...@@ -2840,10 +2840,10 @@ class Navigator extends StatefulWidget { ...@@ -2840,10 +2840,10 @@ class Navigator extends StatefulWidget {
// This should result in result = ['A', null,'A/B/C'] where 'A/B' produces // This should result in result = ['A', null,'A/B/C'] where 'A/B' produces
// the null. In this case, we want to filter out the null and return // the null. In this case, we want to filter out the null and return
// result = ['A', 'A/B/C']. // result = ['A', 'A/B/C'].
result.removeWhere((Route<Object?>? route) => route == null); result.removeWhere((Route<dynamic>? route) => route == null);
if (result.isEmpty) if (result.isEmpty)
result.add(navigator._routeNamed<Object?>(Navigator.defaultRouteName, arguments: null)); result.add(navigator._routeNamed<dynamic>(Navigator.defaultRouteName, arguments: null));
return result.cast<Route<Object?>>(); return result.cast<Route<dynamic>>();
} }
@override @override
...@@ -2946,15 +2946,15 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -2946,15 +2946,15 @@ class _RouteEntry extends RouteTransitionRecord {
currentState = initialState; currentState = initialState;
@override @override
final Route<Object?> route; final Route<dynamic> route;
final _RestorationInformation? restorationInformation; final _RestorationInformation? restorationInformation;
static Route<Object?> notAnnounced = _NotAnnounced(); static Route<dynamic> notAnnounced = _NotAnnounced();
_RouteLifecycle currentState; _RouteLifecycle currentState;
Route<Object?>? lastAnnouncedPreviousRoute = notAnnounced; // last argument to Route.didChangePrevious Route<dynamic>? lastAnnouncedPreviousRoute = notAnnounced; // last argument to Route.didChangePrevious
Route<Object?> lastAnnouncedPoppedNextRoute = notAnnounced; // last argument to Route.didPopNext Route<dynamic> lastAnnouncedPoppedNextRoute = notAnnounced; // last argument to Route.didPopNext
Route<Object?>? lastAnnouncedNextRoute = notAnnounced; // last argument to Route.didChangeNext Route<dynamic>? lastAnnouncedNextRoute = notAnnounced; // last argument to Route.didChangeNext
/// Restoration ID to be used for the encapsulating route when restoration is /// Restoration ID to be used for the encapsulating route when restoration is
/// enabled for it or null if restoration cannot be enabled for it. /// enabled for it or null if restoration cannot be enabled for it.
...@@ -2973,16 +2973,16 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -2973,16 +2973,16 @@ class _RouteEntry extends RouteTransitionRecord {
bool get hasPage => route.settings is Page; bool get hasPage => route.settings is Page;
bool canUpdateFrom(Page<Object?> page) { bool canUpdateFrom(Page<dynamic> page) {
if (currentState.index > _RouteLifecycle.idle.index) if (currentState.index > _RouteLifecycle.idle.index)
return false; return false;
if (!hasPage) if (!hasPage)
return false; return false;
final Page<Object?> routePage = route.settings as Page<Object?>; final Page<dynamic> routePage = route.settings as Page<dynamic>;
return page.canUpdate(routePage); return page.canUpdate(routePage);
} }
void handleAdd({ required NavigatorState navigator, required Route<Object?>? previousPresent }) { void handleAdd({ required NavigatorState navigator, required Route<dynamic>? previousPresent }) {
assert(currentState == _RouteLifecycle.add); assert(currentState == _RouteLifecycle.add);
assert(navigator != null); assert(navigator != null);
assert(navigator._debugLocked); assert(navigator._debugLocked);
...@@ -2996,7 +2996,7 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -2996,7 +2996,7 @@ class _RouteEntry extends RouteTransitionRecord {
); );
} }
void handlePush({ required NavigatorState navigator, required bool isNewFirst, required Route<Object?>? previous, required Route<Object?>? previousPresent }) { void handlePush({ required NavigatorState navigator, required bool isNewFirst, required Route<dynamic>? previous, required Route<dynamic>? previousPresent }) {
assert(currentState == _RouteLifecycle.push || currentState == _RouteLifecycle.pushReplace || currentState == _RouteLifecycle.replace); assert(currentState == _RouteLifecycle.push || currentState == _RouteLifecycle.pushReplace || currentState == _RouteLifecycle.replace);
assert(navigator != null); assert(navigator != null);
assert(navigator._debugLocked); assert(navigator._debugLocked);
...@@ -3042,12 +3042,12 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -3042,12 +3042,12 @@ class _RouteEntry extends RouteTransitionRecord {
} }
} }
void handleDidPopNext(Route<Object?> poppedRoute) { void handleDidPopNext(Route<dynamic> poppedRoute) {
route.didPopNext(poppedRoute); route.didPopNext(poppedRoute);
lastAnnouncedPoppedNextRoute = poppedRoute; lastAnnouncedPoppedNextRoute = poppedRoute;
} }
void handlePop({ required NavigatorState navigator, required Route<Object?>? previousPresent }) { void handlePop({ required NavigatorState navigator, required Route<dynamic>? previousPresent }) {
assert(navigator != null); assert(navigator != null);
assert(navigator._debugLocked); assert(navigator._debugLocked);
assert(route._navigator == navigator); assert(route._navigator == navigator);
...@@ -3057,7 +3057,7 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -3057,7 +3057,7 @@ class _RouteEntry extends RouteTransitionRecord {
); );
} }
void handleRemoval({ required NavigatorState navigator, required Route<Object?>? previousPresent }) { void handleRemoval({ required NavigatorState navigator, required Route<dynamic>? previousPresent }) {
assert(navigator != null); assert(navigator != null);
assert(navigator._debugLocked); assert(navigator._debugLocked);
assert(route._navigator == navigator); assert(route._navigator == navigator);
...@@ -3181,7 +3181,7 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -3181,7 +3181,7 @@ class _RouteEntry extends RouteTransitionRecord {
currentState.index >= _RouteLifecycle.push.index; currentState.index >= _RouteLifecycle.push.index;
} }
bool shouldAnnounceChangeToNext(Route<Object?>? nextRoute) { bool shouldAnnounceChangeToNext(Route<dynamic>? nextRoute) {
assert(nextRoute != lastAnnouncedNextRoute); assert(nextRoute != lastAnnouncedNextRoute);
// Do not announce if `next` changes from a just popped route to null. We // Do not announce if `next` changes from a just popped route to null. We
// already announced this change by calling didPopNext. // already announced this change by calling didPopNext.
...@@ -3196,7 +3196,7 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -3196,7 +3196,7 @@ class _RouteEntry extends RouteTransitionRecord {
static bool suitableForTransitionAnimationPredicate(_RouteEntry entry) => entry.suitableForTransitionAnimation; static bool suitableForTransitionAnimationPredicate(_RouteEntry entry) => entry.suitableForTransitionAnimation;
static bool willBePresentPredicate(_RouteEntry entry) => entry.willBePresent; static bool willBePresentPredicate(_RouteEntry entry) => entry.willBePresent;
static _RouteEntryPredicate isRoutePredicate(Route<Object?> route) { static _RouteEntryPredicate isRoutePredicate(Route<dynamic> route) {
return (_RouteEntry entry) => entry.route == route; return (_RouteEntry entry) => entry.route == route;
} }
...@@ -3230,25 +3230,25 @@ class _RouteEntry extends RouteTransitionRecord { ...@@ -3230,25 +3230,25 @@ class _RouteEntry extends RouteTransitionRecord {
} }
@override @override
void markForPop([Object? result]) { void markForPop([dynamic result]) {
assert( assert(
!isWaitingForEnteringDecision && isWaitingForExitingDecision && isPresent, !isWaitingForEnteringDecision && isWaitingForExitingDecision && isPresent,
'This route cannot be marked for pop. Either a decision has already been ' 'This route cannot be marked for pop. Either a decision has already been '
'made or it does not require an explicit decision on how to transition out.', 'made or it does not require an explicit decision on how to transition out.',
); );
pop<Object?>(result); pop<dynamic>(result);
_isWaitingForExitingDecision = false; _isWaitingForExitingDecision = false;
} }
@override @override
void markForComplete([Object? result]) { void markForComplete([dynamic result]) {
assert( assert(
!isWaitingForEnteringDecision && isWaitingForExitingDecision && isPresent, !isWaitingForEnteringDecision && isWaitingForExitingDecision && isPresent,
'This route cannot be marked for complete. Either a decision has already ' 'This route cannot be marked for complete. Either a decision has already '
'been made or it does not require an explicit decision on how to transition ' 'been made or it does not require an explicit decision on how to transition '
'out.', 'out.',
); );
complete<Object?>(result); complete<dynamic>(result);
_isWaitingForExitingDecision = false; _isWaitingForExitingDecision = false;
} }
...@@ -3276,16 +3276,16 @@ abstract class _NavigatorObservation { ...@@ -3276,16 +3276,16 @@ abstract class _NavigatorObservation {
this.primaryRoute, this.primaryRoute,
this.secondaryRoute, this.secondaryRoute,
); );
final Route<Object?> primaryRoute; final Route<dynamic> primaryRoute;
final Route<Object?>? secondaryRoute; final Route<dynamic>? secondaryRoute;
void notify(NavigatorObserver observer); void notify(NavigatorObserver observer);
} }
class _NavigatorPushObservation extends _NavigatorObservation { class _NavigatorPushObservation extends _NavigatorObservation {
_NavigatorPushObservation( _NavigatorPushObservation(
Route<Object?> primaryRoute, Route<dynamic> primaryRoute,
Route<Object?>? secondaryRoute, Route<dynamic>? secondaryRoute,
) : super(primaryRoute, secondaryRoute); ) : super(primaryRoute, secondaryRoute);
@override @override
...@@ -3296,8 +3296,8 @@ class _NavigatorPushObservation extends _NavigatorObservation { ...@@ -3296,8 +3296,8 @@ class _NavigatorPushObservation extends _NavigatorObservation {
class _NavigatorPopObservation extends _NavigatorObservation { class _NavigatorPopObservation extends _NavigatorObservation {
_NavigatorPopObservation( _NavigatorPopObservation(
Route<Object?> primaryRoute, Route<dynamic> primaryRoute,
Route<Object?>? secondaryRoute, Route<dynamic>? secondaryRoute,
) : super(primaryRoute, secondaryRoute); ) : super(primaryRoute, secondaryRoute);
@override @override
...@@ -3308,8 +3308,8 @@ class _NavigatorPopObservation extends _NavigatorObservation { ...@@ -3308,8 +3308,8 @@ class _NavigatorPopObservation extends _NavigatorObservation {
class _NavigatorRemoveObservation extends _NavigatorObservation { class _NavigatorRemoveObservation extends _NavigatorObservation {
_NavigatorRemoveObservation( _NavigatorRemoveObservation(
Route<Object?> primaryRoute, Route<dynamic> primaryRoute,
Route<Object?>? secondaryRoute, Route<dynamic>? secondaryRoute,
) : super(primaryRoute, secondaryRoute); ) : super(primaryRoute, secondaryRoute);
@override @override
...@@ -3320,8 +3320,8 @@ class _NavigatorRemoveObservation extends _NavigatorObservation { ...@@ -3320,8 +3320,8 @@ class _NavigatorRemoveObservation extends _NavigatorObservation {
class _NavigatorReplaceObservation extends _NavigatorObservation { class _NavigatorReplaceObservation extends _NavigatorObservation {
_NavigatorReplaceObservation( _NavigatorReplaceObservation(
Route<Object?> primaryRoute, Route<dynamic> primaryRoute,
Route<Object?>? secondaryRoute, Route<dynamic>? secondaryRoute,
) : super(primaryRoute, secondaryRoute); ) : super(primaryRoute, secondaryRoute);
@override @override
...@@ -3353,7 +3353,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3353,7 +3353,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
void initState() { void initState() {
super.initState(); super.initState();
assert((){ assert((){
if (widget.pages != const <Page<Object?>>[]) { if (widget.pages != const <Page<dynamic>>[]) {
// This navigator uses page API. // This navigator uses page API.
if (widget.pages.isEmpty) { if (widget.pages.isEmpty) {
FlutterError.reportError( FlutterError.reportError(
...@@ -3414,7 +3414,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3414,7 +3414,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
// Populate the new history from restoration data. // Populate the new history from restoration data.
_history.addAll(_serializableHistory.restoreEntriesForPage(null, this)); _history.addAll(_serializableHistory.restoreEntriesForPage(null, this));
for (final Page<Object?> page in widget.pages) { for (final Page<dynamic> page in widget.pages) {
final _RouteEntry entry = _RouteEntry( final _RouteEntry entry = _RouteEntry(
page.createRoute(context), page.createRoute(context),
initialState: _RouteLifecycle.add, initialState: _RouteLifecycle.add,
...@@ -3439,7 +3439,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3439,7 +3439,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
widget.onGenerateInitialRoutes( widget.onGenerateInitialRoutes(
this, this,
widget.initialRoute ?? Navigator.defaultRouteName, widget.initialRoute ?? Navigator.defaultRouteName,
).map((Route<Object?> route) => _RouteEntry( ).map((Route<dynamic> route) => _RouteEntry(
route, route,
initialState: _RouteLifecycle.add, initialState: _RouteLifecycle.add,
restorationInformation: route.settings.name != null restorationInformation: route.settings.name != null
...@@ -3550,7 +3550,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3550,7 +3550,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
void didUpdateWidget(Navigator oldWidget) { void didUpdateWidget(Navigator oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
assert((){ assert((){
if (widget.pages != const <Page<Object?>>[]) { if (widget.pages != const <Page<dynamic>>[]) {
// This navigator uses page API. // This navigator uses page API.
if (widget.pages.isEmpty) { if (widget.pages.isEmpty) {
FlutterError.reportError( FlutterError.reportError(
...@@ -3613,7 +3613,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3613,7 +3613,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
void _debugCheckDuplicatedPageKeys() { void _debugCheckDuplicatedPageKeys() {
assert((){ assert((){
final Set<Key> keyReservation = <Key>{}; final Set<Key> keyReservation = <Key>{};
for (final Page<Object?> page in widget.pages) { for (final Page<dynamic> page in widget.pages) {
final LocalKey? key = page.key; final LocalKey? key = page.key;
if (key != null) { if (key != null) {
assert(!keyReservation.contains(key)); assert(!keyReservation.contains(key));
...@@ -3726,7 +3726,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3726,7 +3726,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
} }
if (newPagesBottom > newPagesTop) if (newPagesBottom > newPagesTop)
break; break;
final Page<Object?> newPage = widget.pages[newPagesBottom]; final Page<dynamic> newPage = widget.pages[newPagesBottom];
if (!oldEntry.canUpdateFrom(newPage)) if (!oldEntry.canUpdateFrom(newPage))
break; break;
previousOldPageRouteEntry = oldEntry; previousOldPageRouteEntry = oldEntry;
...@@ -3748,7 +3748,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3748,7 +3748,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
oldEntriesTop -= 1; oldEntriesTop -= 1;
continue; continue;
} }
final Page<Object?> newPage = widget.pages[newPagesTop]; final Page<dynamic> newPage = widget.pages[newPagesTop];
if (!oldEntry.canUpdateFrom(newPage)) if (!oldEntry.canUpdateFrom(newPage))
break; break;
// We found the page for all the consecutive pageless routes below. Those // We found the page for all the consecutive pageless routes below. Those
...@@ -3777,7 +3777,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3777,7 +3777,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
assert(oldEntry.hasPage); assert(oldEntry.hasPage);
final Page<Object?> page = oldEntry.route.settings as Page<Object?>; final Page<dynamic> page = oldEntry.route.settings as Page<dynamic>;
if (page.key == null) if (page.key == null)
continue; continue;
...@@ -3787,7 +3787,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3787,7 +3787,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
// Updates the middle of the list. // Updates the middle of the list.
while (newPagesBottom <= newPagesTop) { while (newPagesBottom <= newPagesTop) {
final Page<Object?> nextPage = widget.pages[newPagesBottom]; final Page<dynamic> nextPage = widget.pages[newPagesBottom];
newPagesBottom += 1; newPagesBottom += 1;
if ( if (
nextPage.key == null || nextPage.key == null ||
...@@ -3836,7 +3836,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3836,7 +3836,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
continue; continue;
} }
final Page<Object?> potentialPageToRemove = potentialEntryToRemove.route.settings as Page<Object?>; final Page<dynamic> potentialPageToRemove = potentialEntryToRemove.route.settings as Page<dynamic>;
// Marks for transition delegate to remove if this old page does not have // Marks for transition delegate to remove if this old page does not have
// a key or was not taken during updating the middle of new page. // a key or was not taken during updating the middle of new page.
if ( if (
...@@ -3882,7 +3882,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3882,7 +3882,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
continue; continue;
} }
previousOldPageRouteEntry = oldEntry; previousOldPageRouteEntry = oldEntry;
final Page<Object?> newPage = widget.pages[newPagesBottom]; final Page<dynamic> newPage = widget.pages[newPagesBottom];
assert(oldEntry.canUpdateFrom(newPage)); assert(oldEntry.canUpdateFrom(newPage));
oldEntry.route._updateSettings(newPage); oldEntry.route._updateSettings(newPage);
newHistory.add(oldEntry); newHistory.add(oldEntry);
...@@ -3928,7 +3928,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -3928,7 +3928,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
_RouteEntry? entry = _history[index]; _RouteEntry? entry = _history[index];
_RouteEntry? previous = index > 0 ? _history[index - 1] : null; _RouteEntry? previous = index > 0 ? _history[index - 1] : null;
bool canRemoveOrAdd = false; // Whether there is a fully opaque route on top to silently remove or add route underneath. bool canRemoveOrAdd = false; // Whether there is a fully opaque route on top to silently remove or add route underneath.
Route<Object?>? poppedRoute; // The route that should trigger didPopNext on the top active route. Route<dynamic>? poppedRoute; // The route that should trigger didPopNext on the top active route.
bool seenTopActiveRoute = false; // Whether we've seen the route that would get didPopNext. bool seenTopActiveRoute = false; // Whether we've seen the route that would get didPopNext.
final List<_RouteEntry> toBeDisposed = <_RouteEntry>[]; final List<_RouteEntry> toBeDisposed = <_RouteEntry>[];
while (index >= 0) { while (index >= 0) {
...@@ -4481,7 +4481,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4481,7 +4481,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
return route.popped; return route.popped;
} }
bool _debugCheckIsPagelessRoute(Route<Object?> route) { bool _debugCheckIsPagelessRoute(Route<dynamic> route) {
assert((){ assert((){
if (route.settings is Page) { if (route.settings is Page) {
FlutterError.reportError( FlutterError.reportError(
...@@ -4578,19 +4578,19 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4578,19 +4578,19 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
_afterNavigation(entry.route); _afterNavigation(entry.route);
} }
void _afterNavigation(Route<Object?>? route) { void _afterNavigation(Route<dynamic>? route) {
if (!kReleaseMode) { if (!kReleaseMode) {
// Among other uses, performance tools use this event to ensure that perf // Among other uses, performance tools use this event to ensure that perf
// stats reflect the time interval since the last navigation event // stats reflect the time interval since the last navigation event
// occurred, ensuring that stats only reflect the current page. // occurred, ensuring that stats only reflect the current page.
Map<String, Object?>? routeJsonable; Map<String, dynamic>? routeJsonable;
if (route != null) { if (route != null) {
routeJsonable = <String, Object?>{}; routeJsonable = <String, dynamic>{};
final String description; final String description;
if (route is TransitionRoute<Object?>) { if (route is TransitionRoute<dynamic>) {
final TransitionRoute<Object?> transitionRoute = route; final TransitionRoute<dynamic> transitionRoute = route;
description = transitionRoute.debugLabel; description = transitionRoute.debugLabel;
} else { } else {
description = '$route'; description = '$route';
...@@ -4598,7 +4598,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4598,7 +4598,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
routeJsonable['description'] = description; routeJsonable['description'] = description;
final RouteSettings settings = route.settings; final RouteSettings settings = route.settings;
final Map<String, Object?> settingsJsonable = <String, Object?> { final Map<String, dynamic> settingsJsonable = <String, dynamic> {
'name': settings.name, 'name': settings.name,
}; };
if (settings.arguments != null) { if (settings.arguments != null) {
...@@ -4610,7 +4610,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4610,7 +4610,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
routeJsonable['settings'] = settingsJsonable; routeJsonable['settings'] = settingsJsonable;
} }
developer.postEvent('Flutter.Navigation', <String, Object?>{ developer.postEvent('Flutter.Navigation', <String, dynamic>{
'route': routeJsonable, 'route': routeJsonable,
}); });
} }
...@@ -4852,7 +4852,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4852,7 +4852,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// * [restorableReplace], which adds a replacement route that can be /// * [restorableReplace], which adds a replacement route that can be
/// restored during state restoration. /// restored during state restoration.
@optionalTypeArgs @optionalTypeArgs
void replace<T extends Object?>({ required Route<Object?> oldRoute, required Route<T> newRoute }) { void replace<T extends Object?>({ required Route<dynamic> oldRoute, required Route<T> newRoute }) {
assert(!_debugLocked); assert(!_debugLocked);
assert(oldRoute != null); assert(oldRoute != null);
assert(oldRoute._navigator == this); assert(oldRoute._navigator == this);
...@@ -4870,7 +4870,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4870,7 +4870,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// ///
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue} /// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
@optionalTypeArgs @optionalTypeArgs
String restorableReplace<T extends Object?>({ required Route<Object?> oldRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) { String restorableReplace<T extends Object?>({ required Route<dynamic> oldRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) {
assert(oldRoute != null); assert(oldRoute != null);
assert(oldRoute._navigator == this); assert(oldRoute._navigator == this);
assert(newRouteBuilder != null); assert(newRouteBuilder != null);
...@@ -4886,7 +4886,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4886,7 +4886,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
return entry.restorationId!; return entry.restorationId!;
} }
void _replaceEntry(_RouteEntry entry, Route<Object?> oldRoute) { void _replaceEntry(_RouteEntry entry, Route<dynamic> oldRoute) {
assert(!_debugLocked); assert(!_debugLocked);
if (oldRoute == entry.route) if (oldRoute == entry.route)
return; return;
...@@ -4923,7 +4923,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4923,7 +4923,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// * [restorableReplaceRouteBelow], which adds a replacement route that can /// * [restorableReplaceRouteBelow], which adds a replacement route that can
/// be restored during state restoration. /// be restored during state restoration.
@optionalTypeArgs @optionalTypeArgs
void replaceRouteBelow<T extends Object?>({ required Route<Object?> anchorRoute, required Route<T> newRoute }) { void replaceRouteBelow<T extends Object?>({ required Route<dynamic> anchorRoute, required Route<T> newRoute }) {
assert(newRoute != null); assert(newRoute != null);
assert(newRoute._navigator == null); assert(newRoute._navigator == null);
assert(anchorRoute != null); assert(anchorRoute != null);
...@@ -4942,7 +4942,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4942,7 +4942,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// ///
/// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue} /// {@macro flutter.widgets.Navigator.restorablePushNamed.returnValue}
@optionalTypeArgs @optionalTypeArgs
String restorableReplaceRouteBelow<T extends Object?>({ required Route<Object?> anchorRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) { String restorableReplaceRouteBelow<T extends Object?>({ required Route<dynamic> anchorRoute, required RestorableRouteBuilder<T> newRouteBuilder, Object? arguments }) {
assert(anchorRoute != null); assert(anchorRoute != null);
assert(anchorRoute._navigator == this); assert(anchorRoute._navigator == this);
assert(newRouteBuilder != null); assert(newRouteBuilder != null);
...@@ -4958,7 +4958,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -4958,7 +4958,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
return entry.restorationId!; return entry.restorationId!;
} }
void _replaceEntryBelow(_RouteEntry entry, Route<Object?> anchorRoute) { void _replaceEntryBelow(_RouteEntry entry, Route<dynamic> anchorRoute) {
assert(!_debugLocked); assert(!_debugLocked);
assert(() { _debugLocked = true; return true; }()); assert(() { _debugLocked = true; return true; }());
final int anchorIndex = _history.indexWhere(_RouteEntry.isRoutePredicate(anchorRoute)); final int anchorIndex = _history.indexWhere(_RouteEntry.isRoutePredicate(anchorRoute));
...@@ -5122,7 +5122,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -5122,7 +5122,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// Immediately remove `route` from the navigator, and [Route.dispose] it. /// Immediately remove `route` from the navigator, and [Route.dispose] it.
/// ///
/// {@macro flutter.widgets.navigator.removeRoute} /// {@macro flutter.widgets.navigator.removeRoute}
void removeRoute(Route<Object?> route) { void removeRoute(Route<dynamic> route) {
assert(route != null); assert(route != null);
assert(!_debugLocked); assert(!_debugLocked);
assert(() { assert(() {
...@@ -5152,7 +5152,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -5152,7 +5152,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// route to be removed is the one below the given `anchorRoute`. /// route to be removed is the one below the given `anchorRoute`.
/// ///
/// {@macro flutter.widgets.navigator.removeRouteBelow} /// {@macro flutter.widgets.navigator.removeRouteBelow}
void removeRouteBelow(Route<Object?> anchorRoute) { void removeRouteBelow(Route<dynamic> anchorRoute) {
assert(!_debugLocked); assert(!_debugLocked);
assert(() { assert(() {
_debugLocked = true; _debugLocked = true;
...@@ -5189,7 +5189,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -5189,7 +5189,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// The given `route` must have already received a call to [Route.didPop]. /// The given `route` must have already received a call to [Route.didPop].
/// This function may be called directly from [Route.didPop] if [Route.didPop] /// This function may be called directly from [Route.didPop] if [Route.didPop]
/// will return true. /// will return true.
void finalizeRoute(Route<Object?> route) { void finalizeRoute(Route<dynamic> route) {
// FinalizeRoute may have been called while we were already locked as a // FinalizeRoute may have been called while we were already locked as a
// responds to route.didPop(). Make sure to leave in the state we were in // responds to route.didPop(). Make sure to leave in the state we were in
// before the call. // before the call.
...@@ -5250,8 +5250,8 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res ...@@ -5250,8 +5250,8 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
_RouteEntry.willBePresentPredicate, _RouteEntry.willBePresentPredicate,
); );
assert(routeIndex != null); assert(routeIndex != null);
final Route<Object?> route = _history[routeIndex].route; final Route<dynamic> route = _history[routeIndex].route;
Route<Object?>? previousRoute; Route<dynamic>? previousRoute;
if (!route.willHandlePopInternally && routeIndex > 0) { if (!route.willHandlePopInternally && routeIndex > 0) {
previousRoute = _getRouteBefore( previousRoute = _getRouteBefore(
routeIndex - 1, routeIndex - 1,
...@@ -5382,7 +5382,7 @@ abstract class _RestorationInformation { ...@@ -5382,7 +5382,7 @@ abstract class _RestorationInformation {
} }
@protected @protected
Route<Object?> createRoute(NavigatorState navigator); Route<dynamic> createRoute(NavigatorState navigator);
_RouteEntry toRouteEntry(NavigatorState navigator, {_RouteLifecycle initialState = _RouteLifecycle.add}) { _RouteEntry toRouteEntry(NavigatorState navigator, {_RouteLifecycle initialState = _RouteLifecycle.add}) {
assert(navigator != null); assert(navigator != null);
...@@ -5429,8 +5429,8 @@ class _NamedRestorationInformation extends _RestorationInformation { ...@@ -5429,8 +5429,8 @@ class _NamedRestorationInformation extends _RestorationInformation {
final Object? arguments; final Object? arguments;
@override @override
Route<Object?> createRoute(NavigatorState navigator) { Route<dynamic> createRoute(NavigatorState navigator) {
final Route<Object?> route = navigator._routeNamed<Object?>(name, arguments: arguments, allowNull: false)!; final Route<dynamic> route = navigator._routeNamed<dynamic>(name, arguments: arguments, allowNull: false)!;
assert(route != null); assert(route != null);
return route; return route;
} }
...@@ -5476,8 +5476,8 @@ class _AnonymousRestorationInformation extends _RestorationInformation { ...@@ -5476,8 +5476,8 @@ class _AnonymousRestorationInformation extends _RestorationInformation {
final Object? arguments; final Object? arguments;
@override @override
Route<Object?> createRoute(NavigatorState navigator) { Route<dynamic> createRoute(NavigatorState navigator) {
final Route<Object?> result = routeBuilder(navigator.context, arguments); final Route<dynamic> result = routeBuilder(navigator.context, arguments);
assert(result != null); assert(result != null);
return result; return result;
} }
...@@ -5621,10 +5621,10 @@ class _HistoryProperty extends RestorableProperty<Map<String?, List<Object>>?> { ...@@ -5621,10 +5621,10 @@ class _HistoryProperty extends RestorableProperty<Map<String?, List<Object>>?> {
@override @override
Map<String?, List<Object>>? fromPrimitives(Object? data) { Map<String?, List<Object>>? fromPrimitives(Object? data) {
final Map<Object?, Object?> casted = data! as Map<Object?, Object?>; final Map<dynamic, dynamic> casted = data! as Map<dynamic, dynamic>;
return casted.map<String?, List<Object>>((Object? key, Object? value) => MapEntry<String?, List<Object>>( return casted.map<String?, List<Object>>((dynamic key, dynamic value) => MapEntry<String?, List<Object>>(
key as String?, key as String?,
List<Object>.from(value! as List<Object?>, growable: true), List<Object>.from(value as List<dynamic>, growable: true),
)); ));
} }
...@@ -5962,7 +5962,7 @@ class RestorableRouteFuture<T> extends RestorableProperty<String?> { ...@@ -5962,7 +5962,7 @@ class RestorableRouteFuture<T> extends RestorableProperty<String?> {
_route = _navigator._getRouteById<T>(id); _route = _navigator._getRouteById<T>(id);
assert(_route != null); assert(_route != null);
route!.restorationScopeId.addListener(notifyListeners); route!.restorationScopeId.addListener(notifyListeners);
route!.popped.then((Object? result) { route!.popped.then((dynamic result) {
if (_disposed) { if (_disposed) {
return; return;
} }
......
...@@ -225,7 +225,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -225,7 +225,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
} }
@override @override
void didReplace(Route<Object?>? oldRoute) { void didReplace(Route<dynamic>? oldRoute) {
assert(_controller != null, '$runtimeType.didReplace called before calling install() or after calling dispose().'); assert(_controller != null, '$runtimeType.didReplace called before calling install() or after calling dispose().');
assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.'); assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.');
if (oldRoute is TransitionRoute) if (oldRoute is TransitionRoute)
...@@ -243,7 +243,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -243,7 +243,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
} }
@override @override
void didPopNext(Route<Object?> nextRoute) { void didPopNext(Route<dynamic> nextRoute) {
assert(_controller != null, '$runtimeType.didPopNext called before calling install() or after calling dispose().'); assert(_controller != null, '$runtimeType.didPopNext called before calling install() or after calling dispose().');
assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.'); assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.');
_updateSecondaryAnimation(nextRoute); _updateSecondaryAnimation(nextRoute);
...@@ -251,7 +251,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -251,7 +251,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
} }
@override @override
void didChangeNext(Route<Object?>? nextRoute) { void didChangeNext(Route<dynamic>? nextRoute) {
assert(_controller != null, '$runtimeType.didChangeNext called before calling install() or after calling dispose().'); assert(_controller != null, '$runtimeType.didChangeNext called before calling install() or after calling dispose().');
assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.'); assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.');
_updateSecondaryAnimation(nextRoute); _updateSecondaryAnimation(nextRoute);
...@@ -265,14 +265,14 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -265,14 +265,14 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
// caller must reset this property to null after it is called. // caller must reset this property to null after it is called.
VoidCallback? _trainHoppingListenerRemover; VoidCallback? _trainHoppingListenerRemover;
void _updateSecondaryAnimation(Route<Object?>? nextRoute) { void _updateSecondaryAnimation(Route<dynamic>? nextRoute) {
// There is an existing train hopping in progress. Unfortunately, we cannot // There is an existing train hopping in progress. Unfortunately, we cannot
// dispose current train hopping animation until we replace it with a new // dispose current train hopping animation until we replace it with a new
// animation. // animation.
final VoidCallback? previousTrainHoppingListenerRemover = _trainHoppingListenerRemover; final VoidCallback? previousTrainHoppingListenerRemover = _trainHoppingListenerRemover;
_trainHoppingListenerRemover = null; _trainHoppingListenerRemover = null;
if (nextRoute is TransitionRoute<Object?> && canTransitionTo(nextRoute) && nextRoute.canTransitionFrom(this)) { if (nextRoute is TransitionRoute<dynamic> && canTransitionTo(nextRoute) && nextRoute.canTransitionFrom(this)) {
final Animation<double>? current = _secondaryAnimation.parent; final Animation<double>? current = _secondaryAnimation.parent;
if (current != null) { if (current != null) {
final Animation<double> currentTrain = (current is TrainHoppingAnimation ? current.currentTrain : current)!; final Animation<double> currentTrain = (current is TrainHoppingAnimation ? current.currentTrain : current)!;
...@@ -348,11 +348,11 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -348,11 +348,11 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
} }
} }
void _setSecondaryAnimation(Animation<double>? animation, [Future<Object?>? disposed]) { void _setSecondaryAnimation(Animation<double>? animation, [Future<dynamic>? disposed]) {
_secondaryAnimation.parent = animation; _secondaryAnimation.parent = animation;
// Releases the reference to the next route's animation when that route // Releases the reference to the next route's animation when that route
// is disposed. // is disposed.
disposed?.then((Object? _) { disposed?.then((dynamic _) {
if (_secondaryAnimation.parent == animation) { if (_secondaryAnimation.parent == animation) {
_secondaryAnimation.parent = kAlwaysDismissedAnimation; _secondaryAnimation.parent = kAlwaysDismissedAnimation;
if (animation is TrainHoppingAnimation) { if (animation is TrainHoppingAnimation) {
...@@ -386,7 +386,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -386,7 +386,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
/// ///
/// * [canTransitionFrom], which must be true for [nextRoute] for the /// * [canTransitionFrom], which must be true for [nextRoute] for the
/// [ModalRoute.buildTransitions] `secondaryAnimation` to run. /// [ModalRoute.buildTransitions] `secondaryAnimation` to run.
bool canTransitionTo(TransitionRoute<Object?> nextRoute) => true; bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => true;
/// Returns true if [previousRoute] should animate when this route /// Returns true if [previousRoute] should animate when this route
/// is pushed on top of it or when then this route is popped off of it. /// is pushed on top of it or when then this route is popped off of it.
...@@ -411,7 +411,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> { ...@@ -411,7 +411,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
/// ///
/// * [canTransitionTo], which must be true for [previousRoute] for its /// * [canTransitionTo], which must be true for [previousRoute] for its
/// [ModalRoute.buildTransitions] `secondaryAnimation` to run. /// [ModalRoute.buildTransitions] `secondaryAnimation` to run.
bool canTransitionFrom(TransitionRoute<Object?> previousRoute) => true; bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) => true;
@override @override
void dispose() { void dispose() {
...@@ -437,7 +437,7 @@ class LocalHistoryEntry { ...@@ -437,7 +437,7 @@ class LocalHistoryEntry {
/// Called when this entry is removed from the history of its associated [LocalHistoryRoute]. /// Called when this entry is removed from the history of its associated [LocalHistoryRoute].
final VoidCallback? onRemove; final VoidCallback? onRemove;
LocalHistoryRoute<Object?>? _owner; LocalHistoryRoute<dynamic>? _owner;
/// Remove this entry from the history of its associated [LocalHistoryRoute]. /// Remove this entry from the history of its associated [LocalHistoryRoute].
void remove() { void remove() {
...@@ -660,7 +660,7 @@ class _DismissModalAction extends DismissAction { ...@@ -660,7 +660,7 @@ class _DismissModalAction extends DismissAction {
@override @override
bool isEnabled(DismissIntent intent) { bool isEnabled(DismissIntent intent) {
final ModalRoute<Object?> route = ModalRoute.of<Object?>(context)!; final ModalRoute<dynamic> route = ModalRoute.of<dynamic>(context)!;
return route.barrierDismissible; return route.barrierDismissible;
} }
...@@ -685,7 +685,7 @@ class _ModalScopeStatus extends InheritedWidget { ...@@ -685,7 +685,7 @@ class _ModalScopeStatus extends InheritedWidget {
final bool isCurrent; final bool isCurrent;
final bool canPop; final bool canPop;
final Route<Object?> route; final Route<dynamic> route;
@override @override
bool updateShouldNotify(_ModalScopeStatus old) { bool updateShouldNotify(_ModalScopeStatus old) {
...@@ -934,7 +934,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -934,7 +934,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// ///
/// This function is typically used with [Navigator.popUntil()]. /// This function is typically used with [Navigator.popUntil()].
static RoutePredicate withName(String name) { static RoutePredicate withName(String name) {
return (Route<Object?> route) { return (Route<dynamic> route) {
return !route.willHandlePopInternally return !route.willHandlePopInternally
&& route is ModalRoute && route is ModalRoute
&& route.settings.name == name; && route.settings.name == name;
...@@ -1391,7 +1391,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -1391,7 +1391,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// [State.didChangeDependencies] callback: /// [State.didChangeDependencies] callback:
/// ///
/// ```dart /// ```dart
/// ModalRoute<Object?> _route; /// ModalRoute<dynamic> _route;
/// ///
/// @override /// @override
/// void didChangeDependencies() { /// void didChangeDependencies() {
...@@ -1464,7 +1464,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -1464,7 +1464,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
} }
@override @override
void didChangePrevious(Route<Object?>? previousRoute) { void didChangePrevious(Route<dynamic>? previousRoute) {
super.didChangePrevious(previousRoute); super.didChangePrevious(previousRoute);
changedInternalState(); changedInternalState();
} }
...@@ -1613,9 +1613,9 @@ abstract class PopupRoute<T> extends ModalRoute<T> { ...@@ -1613,9 +1613,9 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// as `always_specify_types`, the Dart analyzer will require that certain types /// as `always_specify_types`, the Dart analyzer will require that certain types
/// be given with their type arguments. Since the [Route] class and its /// be given with their type arguments. Since the [Route] class and its
/// subclasses have a type argument, this includes the arguments passed to this /// subclasses have a type argument, this includes the arguments passed to this
/// class. Consider using `Object?` to specify the entire class of routes rather /// class. Consider using `dynamic` to specify the entire class of routes rather
/// than only specific subtypes. For example, to watch for all [ModalRoute] /// than only specific subtypes. For example, to watch for all [ModalRoute]
/// variants, the `RouteObserver<ModalRoute<Object?>>` type may be used. /// variants, the `RouteObserver<ModalRoute<dynamic>>` type may be used.
/// ///
/// {@tool snippet} /// {@tool snippet}
/// ///
...@@ -1670,7 +1670,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> { ...@@ -1670,7 +1670,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// } /// }
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
class RouteObserver<R extends Route<Object?>> extends NavigatorObserver { class RouteObserver<R extends Route<dynamic>> extends NavigatorObserver {
final Map<R, Set<RouteAware>> _listeners = <R, Set<RouteAware>>{}; final Map<R, Set<RouteAware>> _listeners = <R, Set<RouteAware>>{};
/// Subscribe [routeAware] to be informed about changes to [route]. /// Subscribe [routeAware] to be informed about changes to [route].
...@@ -1700,7 +1700,7 @@ class RouteObserver<R extends Route<Object?>> extends NavigatorObserver { ...@@ -1700,7 +1700,7 @@ class RouteObserver<R extends Route<Object?>> extends NavigatorObserver {
} }
@override @override
void didPop(Route<Object?> route, Route<Object?>? previousRoute) { void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
if (route is R && previousRoute is R) { if (route is R && previousRoute is R) {
final List<RouteAware>? previousSubscribers = _listeners[previousRoute]?.toList(); final List<RouteAware>? previousSubscribers = _listeners[previousRoute]?.toList();
...@@ -1721,7 +1721,7 @@ class RouteObserver<R extends Route<Object?>> extends NavigatorObserver { ...@@ -1721,7 +1721,7 @@ class RouteObserver<R extends Route<Object?>> extends NavigatorObserver {
} }
@override @override
void didPush(Route<Object?> route, Route<Object?>? previousRoute) { void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
if (route is R && previousRoute is R) { if (route is R && previousRoute is R) {
final Set<RouteAware>? previousSubscribers = _listeners[previousRoute]; final Set<RouteAware>? previousSubscribers = _listeners[previousRoute];
......
...@@ -117,7 +117,7 @@ class WillPopScope extends StatefulWidget { ...@@ -117,7 +117,7 @@ class WillPopScope extends StatefulWidget {
} }
class _WillPopScopeState extends State<WillPopScope> { class _WillPopScopeState extends State<WillPopScope> {
ModalRoute<Object?>? _route; ModalRoute<dynamic>? _route;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment