Scenario: You take the plunge and decide to upgrading your Flutter app from version 1.x to 2.x. You upgrade Flutter, then you upgrade your app and all its packages, and you are now ready to run the app.
You fire up the app in an emulator or on your device and you met with the following error:
Caught error: Null check operator used on a null value #0 PageRedirect.page (package:get/get_navigation/src/routes/route_middleware.dart:199:50) #1 GetMaterialApp.initialRoutesGenerate (package:get/get_navigation/src/root/get_material_app.dart:212:9) ... ... etc
The error comes from the Get package, but its all up to date so what gives?
In Flutter 2.0, web support was officially introduced, which means some of the routing under the hood have changed. Web does not understand simply named routes, instead you have to define them more like URL paths.
All your names routes MUST begin with a forward-slash. For example, if your named route was previously simply
user-dashboard you will now have to prefix it with a forward-slash like so
/user-dashboard and that should take care of the issue.
Hope this helps anyone else facing this issue. The error message was not very helpful so tracking this bug down was quite a mission, and in the end a colleague of mine managed to track it and squish it!