Closed pinpong closed 1 year ago
Also the example needs to be updated and migrate to null safety.
======== Exception caught by gesture =============================================================== The following _TypeError was thrown while handling a gesture: type 'Null' is not a subtype of type 'Handler'
When the exception was thrown, this was the stack:
I also in version 2.0.3, how to repair...
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _TypeError was thrown building IconTheme(color: Color(0xdd000000)):
type 'Null' is not a subtype of type 'Handler'
The relevant error-causing widget was:
MaterialApp file:///Users/agarzas/Development/app/lib/main.dart:93:20
When the exception was thrown, this was the stack:
#0 FluroRouter.matchRoute (package:fluro/src/fluro_router.dart:143:13)
#1 FluroRouter.generator (package:fluro/src/fluro_router.dart:278:9)
#2 _WidgetsAppState._onGenerateRoute (package:flutter/src/widgets/app.dart:1212:37)
#3 NavigatorState._routeNamed (package:flutter/src/widgets/navigator.dart:4133:46)
#4 Navigator.defaultGenerateInitialRoutes (package:flutter/src/widgets/navigator.dart:2783:28)
#5 NavigatorState.restoreState (package:flutter/src/widgets/navigator.dart:3418:41)
#6 RestorationMixin._doRestore (package:flutter/src/widgets/restoration.dart:982:5)
#7 RestorationMixin.didChangeDependencies (package:flutter/src/widgets/restoration.dart:968:7)
#8 NavigatorState.didChangeDependencies (package:flutter/src/widgets/navigator.dart:3464:11)
#9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4653:11)
#10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4469:5)
... Normal element mounting (92 frames)
#102 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#103 Element.updateChild (package:flutter/src/widgets/framework.dart:3303:20)
#104 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4520:16)
#105 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4667:11)
#106 Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
#107 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2694:33)
#108 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:873:21)
#109 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#110 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#111 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#112 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:865:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
same here, fluro: ^2.0.3
Flutter 2.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b1395592de (2 weeks ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2
I use dev null-safety channel use 2.0.3 latest version meet the same error. Where is the bad way I used? I can't find from my codes. -----update-- I solved this issue. when I in main.dart I create final router = FluroRouter() than I pass this instance to Routes.configureRouters() I get the issue. but just I try final router = FluroRouter.appRouter; it works now. So it tell us we should use FluroRouter.appRouter not to create instance ourselves. try it.
Finally figured this out, it's the notFoundHandler, had to add this:
router.notFoundHandler = Handler(
handlerFunc: (BuildContext? context, Map<String, dynamic> params) {
return NotFoundPage();
});
Did you make a pull request?
Not using fluor anymore an i think this is not the only issue with null safety refactoring.
Seems to be fine otherwise, but might be some things I haven't run into.
What are you using now?
Exception has occurred.
_TypeError (type 'Null' is not a subtype of type 'FutureOr<List
I had the same issue with Fluro when implementing Flutter Add2App. This issue was happening to me in runtime. I spent several hours trying to find the solution to this issue.
Here are my findings - When I was opening the flutter app it is opening the home route (“/") first. I haven’t defined this route with some handler that’s why this issue was there.
The issue was occurring on the “mathRoute” function in FluroRouter Code on this line -
Handler handler = (route != null ? route.handler : notFoundHandler);
here I was getting route = “/“ and route.handler = null
so because the Handler is a not nullable type this error was appearing.
So It is just like working with a web URL so, whatever be my “initial route” say “/about”, it will open the home route(“/“) first then the "about" route
If you want to know more you can check the “defaultGenerateInitialRoutes” function in the navigator class. Nice documentation is there to explain all of this.
To solve this for now I ended up setting my initial route as the home route(“/“).
Hey guys I have the new issue, related with Flurorouter
static final notFound = Handler(handlerFunc: ((context, parameters) { return const NotFoundPage(); }));
This is in other document:
router.notFoundHandler = MyFluroHandlers.notFound;
Flutter 3.0.5 used to work, but now I've tried it on a new project, but it doesn't work.
I really love Flutter, but I'm considering quitting it.
Any ideas to save this fabulous plugin?
Got this issue when compile null safety with flutter 2.0.2.