-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in navigateBack #5
Comments
Same issue here! Just installed this library and got this error message on compile.
|
same here |
I'm surprised this hasn't been revised yet since I gave the fix in the question. It's official that with the latest Flutter releases that Navigator.of(context).pop and push no longer returns a bool, it returns nothing. I've been using this plugin off of my fork where I made the change, but I didn't think I needed to do a Pull Request since it was as simple as changing the bool to void... |
And it also does not need to be a bool because if you want to check navigation you have observers to do it |
I want to use these extensions, but as soon as I import in my existing project, before I even used any of the methods, I'm getting this error:
Compiler message:
/d:/Program%20Files/Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_extensions-0.3.4/lib/src/flutter/navigation.dart:21:49: Error: This expression has type 'void' and can't be used.
bool navigateBack({T result}) => Navigator.pop(context, result);
^
/d:/Program%20Files/Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_extensions-0.3.4/lib/src/flutter/navigation.dart:33:81: Error: This expression has type 'void' and can't be used.
So I checked out that file, fiddled around with it and realized you had to change bool to void (as it says) so line 21 & 33 are like this:
void navigateBack<T>({T result}) => Navigator.pop(context, result);
Easy enough fix, no one would need to really check for a bool result when they're navigating back, so makes sense. The code should compile once that's changed, not sure on how it would of worked for others, it's possible if it didn't give you that error that there was a breaking change in a Flutter update, dunno. Anyways, thanks, one of the better sets of extensions that I was looking for, looking forward to future helper shortcuts, maybe I'll submit a few down the line...
The text was updated successfully, but these errors were encountered: