Skip to content
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

Open
Skquark opened this issue Mar 12, 2020 · 4 comments
Open

Error in navigateBack #5

Skquark opened this issue Mar 12, 2020 · 4 comments

Comments

@Skquark
Copy link
Contributor

Skquark commented Mar 12, 2020

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...

@CripyIce
Copy link

Same issue here! Just installed this library and got this error message on compile.

[✓] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.3 19D76, locale en-IL)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[!] VS Code (version 1.43.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (4 available)

@jasonlaw
Copy link

jasonlaw commented May 9, 2020

same here

@Skquark
Copy link
Contributor Author

Skquark commented May 9, 2020

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...

@WilliamCunhaCardoso
Copy link

And it also does not need to be a bool because if you want to check navigation you have observers to do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants