nubank / nuvigator

A powerful routing abstraction over Flutter Navigator, with nested Navigator and Deeplinks
Apache License 2.0
277 stars 33 forks source link

Error trying to run the Nuvigator example #23

Closed silviorp closed 4 years ago

silviorp commented 4 years ago

I'm trying to assess Nuvigator before using in one of my projects but after struggling to make it work in a more complex codebase, I've created the simplest possible project and I'm receiving the following error when I try to run it in the iOS Simulator:

Launching lib/main.dart on iPhone Xs Max in debug mode...

Compiler message:
../../sdks/flutter/.pub-cache/hosted/pub.dartlang.org/nuvigator-0.3.0/lib/src/nuvigator.dart:276:24: Error: This expression has type 'void' and can't be used.
      isPopped = super.pop<T>(result);
                       ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
Failed to build bundle.
Error launching application on iPhone Xs Max.

Could anyone help me with that? Example project repository: https://github.com/shrpereira/nuvigator_flutter_app

leoiacovini commented 4 years ago

Hi @shrpereira ! I tried to clone the repo and run but was not able to reproduce the issue... Tomorrow I will try on an iOS device, but it should't be different.

One thing I noticed is that sadly the README example was wrongly written I will fix it asap. But in your MyScreen you do not need to have a Nuvigator, you can write your normal Flutter code (regarding the screen).

Another thing to point out, is that since 0.3.0 release Nuvigator was update to work with the latest Flutter version (1.12), check if you are updated. Also, this error was happening at startup time?

Can you try the suggestion I made above to see if the error is fixed?

Thanks for the feedback!

silviorp commented 4 years ago

Here are the versions I'm using:

Flutter 1.14.7-pre.138 • channel master • https://github.com/flutter/flutter.git
Framework • revision 49be146953 (33 minutes ago) • 2020-02-05 18:02:20 -0800
Engine • revision 81dffd1241
Tools • Dart 2.8.0 (build 2.8.0-dev.7.0 c8ed304e97)

I've also updated MyScreen to just return a Container() in its build function but the same error persistis.

Trying to run on iOS:

Launching lib/main.dart on iPhone Xs Max in debug mode...

Compiler message:
../../sdks/flutter/.pub-cache/hosted/pub.dartlang.org/nuvigator-0.3.0/lib/src/nuvigator.dart:276:24: Error: This expression has type 'void' and can't be used.
      isPopped = super.pop<T>(result);
                       ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
Failed to build bundle.
Error launching application on iPhone Xs Max.

On Android:

Launching lib/main.dart on Android SDK built for x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

Compiler message:
../../sdks/flutter/.pub-cache/hosted/pub.dartlang.org/nuvigator-0.3.0/lib/src/nuvigator.dart:276:24: Error: This expression has type 'void' and can't be used.
      isPopped = super.pop<T>(result);
                       ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script '/Users/silvio.pereira/Developer/sdks/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 817

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/silvio.pereira/Developer/sdks/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
Finished with error: Gradle task assembleDebug failed with exit code 1

Natively on MacOS:

Building macOS application...
** BUILD FAILED **

The following build commands failed:
    Ld /Users/silvio.pereira/Developer/examples/nuvigator_flutter_app/build/macos/Build/Products/Debug/nuvigator_flutter_app.app/Contents/MacOS/nuvigator_flutter_app normal x86_64
(1 failure)
Finished with error: Build process failed
leoiacovini commented 4 years ago

Okay, I was able to reproduce the error in the master channel of Flutter. Given that the master can have bugs and is not ready for production/usage, I recommend you to switch to the stable channel.

Nevertheless I will debug this issue and try to fix it if possible

leoiacovini commented 4 years ago

Flutter on master is going through a lot of changes regarding the Navigation API: https://github.com/flutter/flutter/pull/44930

I suppose this is going to affect nuvigator as well, and when the time comes we will fix/improve everything taking in consideration the new API.

silviorp commented 4 years ago

Thanks for the help! It was the channel. Changing back to the stable one fixed everything.

The point of using the master channel was to be able to use the Desktop version for development. I'll try to figure out how to keep using it and make Nuvigator to work because I don't wanna loose any of them!

leoiacovini commented 4 years ago

No worries :) I will try to check more in-depth if we can make some workaround to accommodate the current new changes. I will close this issue, and keep track of the problem here: https://github.com/nubank/nuvigator/issues/25 Feel free to comment there :)