-
Notifications
You must be signed in to change notification settings - Fork 5
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
Unable to compile this code #1
Comments
Many compilations errors such as: |
Hi, |
Yes, I am very new with flutter/dart and just trying to get the hang of the navigator stuff. No idea how to generate code or execute the build runner after opening this project in Android Studio. Freezed doc says, "To use Freezed, you will need your typical build_runner/code-generator setup."! May be a parallel article that just keeps everything pure (no freezed/riverpod package) will be very helpful in understanding why freezed and riverpod are great. Again, just a humble suggestion. But anyway, thanks for responding. |
C:\temp\fluttertest\Muccy-flutter-navigation-2.0-article-example-master>flutter pub run build_runner build
|
I really would like to help you I don't use Windows nor Android Studio. I only know that I execute dthose two commands on terminal and I was good to go on my machine: flutter pub get
flutter pub run build_runner build Maybe there as some incompatibilities, because Dart has upgraded a lot in the last months. Sadly I have no free time to check and correct those. If you are interested on my take on freezed and immutability in general, you could read this |
Yes, I understand. No problem. I am just posting it here, in case someone else comes along looking for the same stuff. Finally, got the build runner to work after running: flutter pub upgrade But it is now generating these errors in the code : [WARNING] freezed:freezed on lib/ingredients/model.dart: [SEVERE] freezed:freezed on lib/ingredients/model.dart: The parameter [SEVERE] freezed:freezed on lib/recipes/model.dart: The parameter [WARNING] freezed:freezed on lib/routing/stack.dart: [SEVERE] freezed:freezed on lib/routing/stack.dart: The parameter [INFO] Caching finalized dependency graph... [SEVERE] Failed after 10.7s |
This codebase isn't null safe, but it seems it uses a freezed with null safety enabled. I'll take a quick look and I'll come back if fix is not too long to make |
I managed to get the command "flutter pub run build_runner build" to run to completion after replacing @required with required in several files. But now getting errors in several files because of null safety. For example, in routing/stack.dart says at line 27: |
Yes. Same for me. It must be ported to null safety. Even downgrading dependencies didn't make the trick. (And sadly I have no time to make a migration now) |
I strongly suggest you to read the article and to use pragmatic_navigation in a new project if you are learning Flutter |
I managed to get rid of all compilation errors in the code. Mostly by replacing Key key with Key? key and other such similar null checks. (I know it will probably crash at runtime.) However, when I try to run it, I am now getting errors like these from riverpod stuff:
I guess that the end of this rabbit hole for me! |
You cannot take shortcuts: you have to perform a migration — which is not complicated nor simple |
Getting errors like this:
The method 'when' isn't defined for the type 'AppSection'. (Documentation)
Any idea how to fix?
Seems like a great sample to learn flutter navigation. Is it possible to make this example without any references to addition libraries and features such as @freezed? It is just complicating the matter. Just a request.
The text was updated successfully, but these errors were encountered: