resolve method
Future<RouterConfig?>
resolve(
- ConstantReader stackedApp
)
Implementation
Future<RouterConfig?> resolve(ConstantReader stackedApp) async {
/// If routes is not provided return null
if (!stackedApp.read('routes').isList) return null;
final routesDartObjects = stackedApp.read('routes').listValue;
final generateNavigationExt =
stackedApp.peek('generateNavigationHelperExtension')?.boolValue ??
false;
final routeNamePrefix = stackedApp.peek('routePrefix')?.stringValue ?? '/';
final routesClassName =
stackedApp.peek('routesClassName')?.stringValue ?? 'Routes';
final routerConfig = RouterConfig(
routerClassName: 'StackedRouter',
routesClassName: routesClassName,
routeNamePrefix: routeNamePrefix,
generateNavigationHelper: generateNavigationExt,
);
final extractedRoutes =
await _resolveRoutes(routerConfig, routesDartObjects);
return routerConfig.copyWith(routes: extractedRoutes);
}