withReleaseControl method

ModularRoute withReleaseControl({
  1. String? guardedRoute,
  2. String? redirectTo,
})

Return ChildRoute with ReleaseGuard. without guardedRoute default value is routerName of ChildRoute

Implementation

ModularRoute withReleaseControl({String? guardedRoute, String? redirectTo}) {
  final _guardedRoute = guardedRoute ?? Modular.to.path;
  final _guards = List<RouteGuard>.from(middlewares);
  if (kReleaseMode) {
    _guards.add(ReleaseGuard(_guardedRoute, redirectTo: redirectTo));
  }
  return copyWith(middlewares: _guards);
}