Home > Blockchain >  _AssertionError No GoRouter found in context - firebase-get-to-know-flutter step_02
_AssertionError No GoRouter found in context - firebase-get-to-know-flutter step_02

Time:12-24

Right now I am working on the codelab step_02 from firebase-get-to-know-flutter. At step 5 "Add RSVP functionality", when running my app and pressing the "RSVP" Button on my phone, I always get the following error in the /lib/authentification.dart file "_AssertionError ('package:go_router/src/router.dart': Failed assertion: line 300 pos 12 : 'inherited != null': No GoRouter found in context)".

I made sure that I followed every instruction on this codelab to that point. Couldn't find that much on the internet, and didn't have that much ideas how to handle this, as the error is coming from a file that I didn't even touch so far.
Maybe someone has bumped into this error before and knows it's cause, or someone else has an idea what could be going wrong. Thanks for any help! Link to the codelab : https://firebase.google.com/codelabs/firebase-get-to-know-flutter#4

CodePudding user response:

They updated the code for this CodeLab two days ago, but have (apparently) not yet updated the instructions.

I encountered the same error but was able to solve it by copying over the main.dart, home_page.dart, and app_state.dart files from https://github.com/flutter/codelabs/tree/main/firebase-get-to-know-flutter/step_05/lib

The CodeLab instructions do not even admit to the existence of home_page.dart and app_state.dart. Reader beware!

Until they update the instructions, I advise you to simply read the codelab to get the "gist" of what they are doing, but copy over the files from the reference implementation rather than trying to do the edits manually. I do not think they are up to date.

  • Related