From aa9f6a2a054c9d5ce33262dd68a7f9eee0a5bc9f Mon Sep 17 00:00:00 2001 From: Amine Dakhli <45517430+aminedakhlii@users.noreply.github.com> Date: Sat, 17 Apr 2021 01:24:04 +0100 Subject: [PATCH] replace dynamic by Object/Object? in router.dart (#80476) --- packages/flutter/lib/src/widgets/router.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/widgets/router.dart b/packages/flutter/lib/src/widgets/router.dart index 6db7f7d79774..7c7eb41895ab 100644 --- a/packages/flutter/lib/src/widgets/router.dart +++ b/packages/flutter/lib/src/widgets/router.dart @@ -306,7 +306,7 @@ class Router extends StatefulWidget { /// /// * [maybeOf], which is a similar function, but it will return null instead /// of throwing an exception if no [Router] ancestor exists. - static Router of(BuildContext context) { + static Router of(BuildContext context) { final _RouterScope? scope = context.dependOnInheritedWidgetOfExactType<_RouterScope>(); assert(() { if (scope == null) { @@ -318,7 +318,7 @@ class Router extends StatefulWidget { } return true; }()); - return scope!.routerState.widget; + return scope!.routerState.widget as Router; } /// Retrieves the immediate [Router] ancestor from the given context. @@ -334,9 +334,9 @@ class Router extends StatefulWidget { /// /// * [of], a similar method that returns a non-nullable value, and will /// throw if no [Router] ancestor exists. - static Router? maybeOf(BuildContext context) { + static Router? maybeOf(BuildContext context) { final _RouterScope? scope = context.dependOnInheritedWidgetOfExactType<_RouterScope>(); - return scope?.routerState.widget; + return scope?.routerState.widget as Router?; } /// Forces the [Router] to run the [callback] and reports the route @@ -704,9 +704,9 @@ class _RouterScope extends InheritedWidget { final ValueListenable? routeInformationProvider; final BackButtonDispatcher? backButtonDispatcher; - final RouteInformationParser? routeInformationParser; - final RouterDelegate routerDelegate; - final _RouterState routerState; + final RouteInformationParser? routeInformationParser; + final RouterDelegate routerDelegate; + final _RouterState routerState; @override bool updateShouldNotify(_RouterScope oldWidget) {