Unverified Commit 5baebb88 authored by Zomtir's avatar Zomtir Committed by GitHub

[Docs] RouteObserver<PageRoute> cannot subscribe ModalRoute (#77606)

parent 5e7f6690
...@@ -1610,8 +1610,8 @@ abstract class PopupRoute<T> extends ModalRoute<T> { ...@@ -1610,8 +1610,8 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// 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 `dynamic` 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 [PageRoute] /// than only specific subtypes. For example, to watch for all [ModalRoute]
/// variants, the `RouteObserver<PageRoute<dynamic>>` type may be used. /// variants, the `RouteObserver<ModalRoute<dynamic>>` type may be used.
/// ///
/// {@tool snippet} /// {@tool snippet}
/// ///
...@@ -1620,7 +1620,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> { ...@@ -1620,7 +1620,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// ///
/// ```dart /// ```dart
/// // Register the RouteObserver as a navigation observer. /// // Register the RouteObserver as a navigation observer.
/// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>(); /// final RouteObserver<ModalRoute> routeObserver = RouteObserver<ModalRoute>();
/// void main() { /// void main() {
/// runApp(MaterialApp( /// runApp(MaterialApp(
/// home: Container(), /// home: Container(),
...@@ -1638,7 +1638,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> { ...@@ -1638,7 +1638,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// @override /// @override
/// void didChangeDependencies() { /// void didChangeDependencies() {
/// super.didChangeDependencies(); /// super.didChangeDependencies();
/// routeObserver.subscribe(this, ModalRoute.of(context)); /// routeObserver.subscribe(this, ModalRoute.of(context)!);
/// } /// }
/// ///
/// @override /// @override
......
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