outputFor method
returns O
based on the given input AbstractRouteContext<P>
Implementation
@override
Voyager outputFor(AbstractRouteContext abstractContext) {
final allTheParams = Map<String, String>.from(abstractContext.getParams());
final dynamic extras = abstractContext.getExtras();
VoyagerArgument? argument;
if (extras is VoyagerParam) {
argument = extras.argument;
}
final context = VoyagerContext(
path: abstractContext.url(),
params: allTheParams,
router: router,
argument: argument);
final config = VoyagerUtils.copyIt(path.config);
VoyagerUtils.interpolateDynamic(config, context);
final output = router.voyagerFactory(abstractContext, config);
config.keys.forEach((String key) {
if (key == Voyager.KEY_TYPE) {
final dynamic type = config[key];
assert(type is String,
"Provided type value must be String but is $type instead!");
output[Voyager.KEY_TYPE] = type;
} else {
final plugin = router._plugins[key];
if (plugin != null) {
plugin.outputFor(context, config[key], output);
}
}
});
output.lock();
return output;
}