Line data Source code
1 : part of '../main.dart'; 2 : 3 : /// Use this route to redirect from [path] to [redirectTo] 4 : /// 5 : /// Note that this uses [pushReplacement] so if you are on the web, [path] will not 6 : /// appear in the web history once redirected 7 : class VRouteRedirector extends VRouteElementBuilder { 8 : /// The path that should be matched 9 : final String path; 10 : 11 : /// The path where the user will be redirected 12 : final String redirectTo; 13 : 14 1 : VRouteRedirector({ 15 : required this.path, 16 : required this.redirectTo, 17 : }); 18 : 19 : @override 20 1 : Future<void> beforeEnter(VRedirector vRedirector) async => 21 2 : vRedirector.pushReplacement(redirectTo); 22 : 23 1 : @override 24 1 : List<VRouteElement> buildRoutes() => [ 25 3 : VPath(path: path, stackedRoutes: []), 26 : ]; 27 : }