allow no `defaultNextScreen` nor `setNextScreenAsyncCallback`
Closed this issue · 3 comments
dJani97 commented
I'm using auto_route, I want to implement my own navigation logic, which will push auto_route's own PageRouteInfo
object:
FlutterSplashScreen(
defaultNextScreen: null,
onEnd: context.router.replaceAll([const HomeRoute()]),
...
)
But even though I provided defaultNextScreen: null
, it seems like FlutterSplashScreen is still trying to navigate somewhere. This error gets printed to my console:
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3040 pos 7: '!pageBased || isWaitingForExitingDecision': A page-based route cannot be completed using imperative api, provide a new list without the corresponding Page to Navigator.pages instead.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 _RouteEntry.complete (package:flutter/src/widgets/navigator.dart:3040:7)
#3 NavigatorState._pushReplacementEntry (package:flutter/src/widgets/navigator.dart:4661:56)
#4 NavigatorState.pushReplacement (package:flutter/src/widgets/navigator.dart:4617:5)
#5 Navigator.pushReplacement (package:flutter/src/widgets/navigator.dart:2187:34)
#6 _FlutterSplashScreenState.initState.<anonymous closure> (package:another_flutter_splash_screen/another_flutter_splash_screen.dart:303:17)
#7 new Future.delayed.<anonymous closure> (dart:async/future.dart:427:39)
#8 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#9 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#10 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#11 _RawReceivePort._handleMessage (dart:isolate-pa
Here is the code from FlutterSplashScreen
that's causing this issue:
another_flutter_splash_screen/lib/another_flutter_splash_screen.dart
Lines 318 to 327 in 19ab35f
As you can see, even if a null is passed, it will still try to push an empty Container()
. I would prefer if it did nothing, or if there would be a boolean parameter to disable navigation.