A route guard for access control in Modugo.
Implement this interface to create custom route guards. Guards are evaluated before route activation and may redirect to another path if access is denied.
Example:
final class AuthGuard implements IGuard {
@override
FutureOr<String?> call(BuildContext context, GoRouterState state) {
final authService = context.read<AuthService>();
return authService.isLoggedIn ? null : '/login';
}
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
BuildContext context, GoRouterState state) → FutureOr< String?> - Called before a route is activated.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited