You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sma opened this issue
Sep 16, 2020
· 4 comments
· Fixed by #65997
Labels
f: routesNavigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.P0Critical issues such as a build break or regression
In class Navigator, there is Future<T> push<T>(Route<T> route) and static Future<T> push<T extends Object>(BuildContext context, Route<T> route). The latter restricts T to a subclass of Object which means that a Route<void> doesn't work here. I think, it should be possible to use such a route with both variants. The same if true for other variants of push or replace.
If there is a reason for not allowing Route<void> this should be documented, I think. Currently the documentation stats:
/// The type argument `T` is the route's return type, as used by
/// [currentResult], [popped], and [didPop]. The type `void` may be used if the
/// route does not return a value.
The text was updated successfully, but these errors were encountered:
Some time ago I ported a 7000 LOC app to NNBD and now I regularly check the progress and this was the first problem so far. Therefore, I can't deny or confirm other breakage :) I was able to work around this problem by using Navigator.of(context).push() and my app still runs. BTW, I don't think this is a documentation bug but a a typing error.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
f: routesNavigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.P0Critical issues such as a build break or regression
In class
Navigator
, there isFuture<T> push<T>(Route<T> route)
andstatic Future<T> push<T extends Object>(BuildContext context, Route<T> route)
. The latter restrictsT
to a subclass ofObject
which means that aRoute<void>
doesn't work here. I think, it should be possible to use such a route with both variants. The same if true for other variants of push or replace.If there is a reason for not allowing
Route<void>
this should be documented, I think. Currently the documentation stats:The text was updated successfully, but these errors were encountered: