I use GoRouter package for routing. I found a problem when I use async operations in redirect, a black screen appears after my native splash screen but before my main page.
final GoRouter router = GoRouter(
initialLocation: '/',
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const InitialPage();
},
redirect: (BuildContext context, GoRouterState state) async {
await Future.delayed(const Duration(seconds: 2));
// here may be variables for verifying authentication, it's just an example
return null;
},
),
GoRoute(
path: '/main',
builder: (BuildContext context, GoRouterState state) {
return const MainPage();
},
),
],
);
Are there any ways to get rid of this black screen, but use async/await?