From 5baebb88ff10f1c2dbdb183c9d006b514c416267 Mon Sep 17 00:00:00 2001 From: Zomtir Date: Thu, 11 Mar 2021 02:50:04 +0100 Subject: [PATCH] [Docs] RouteObserver cannot subscribe ModalRoute (#77606) --- packages/flutter/lib/src/widgets/routes.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index b70dabd679..cc34e2810b 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -1610,8 +1610,8 @@ abstract class PopupRoute extends ModalRoute { /// be given with their type arguments. Since the [Route] class and its /// subclasses have a type argument, this includes the arguments passed to this /// class. Consider using `dynamic` to specify the entire class of routes rather -/// than only specific subtypes. For example, to watch for all [PageRoute] -/// variants, the `RouteObserver>` type may be used. +/// than only specific subtypes. For example, to watch for all [ModalRoute] +/// variants, the `RouteObserver>` type may be used. /// /// {@tool snippet} /// @@ -1620,7 +1620,7 @@ abstract class PopupRoute extends ModalRoute { /// /// ```dart /// // Register the RouteObserver as a navigation observer. -/// final RouteObserver routeObserver = RouteObserver(); +/// final RouteObserver routeObserver = RouteObserver(); /// void main() { /// runApp(MaterialApp( /// home: Container(), @@ -1638,7 +1638,7 @@ abstract class PopupRoute extends ModalRoute { /// @override /// void didChangeDependencies() { /// super.didChangeDependencies(); -/// routeObserver.subscribe(this, ModalRoute.of(context)); +/// routeObserver.subscribe(this, ModalRoute.of(context)!); /// } /// /// @override