guards property

List<RouteGuard>? guards

Parameter name: guards

Route guards are middleware-like objects

that allow you to control the access of a given route from other route.

You can implement a route guard by making a class that implements RouteGuard.

Type: List

Example:

class MyGuard implements RouteGuard {
 @override
 Future<bool> canActivate(String url, ModularRoute router) {
   if (url != '/admin'){
     // Return `true` to allow access
     return true;
   } else {
     // Return `false` to disallow access
     return false
   }
 }
}

For more example go to Modular page from gitHub https://github.com/Flutterando/modular

Implementation

List<RouteGuard>? get guards;