DesktopGuard class
Ensures that the user is on a desktop device.
- Inheritance
-
- Object
- Middleware<
ModularArguments> - DesktopGuard
Constructors
- DesktopGuard({bool invert = false, String? redirectTo = '/mobile'})
- Ensures that the user is on a desktop device.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- invert → bool
-
Whether to invert the guard.
final
- redirectTo → String?
-
If the route is not allowed then the Guard will redirect to that route.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canActivate(
String path, ModularRoute route) → Future< bool> -
Returns a FutureOr
. If true, allow the route to continue processing. If it is false, the Guard will try to redirect the route. If there is no redirect then an error will be thrown GuardedRouteException
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pos(
ModularRoute route, ModularArguments data) → FutureOr< ParallelRoute?> -
Method called as soon as route is found and after settings.
inherited
-
pre(
ModularRoute route) → FutureOr< ModularRoute?> -
Method called as soon as route is found and before settings.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
listen(
BuildContext context, {bool invert = false, String redirectTo = '/mobile'}) → void - Listens for window size changes and redirects the user if necessary.
Constants
- minWindowSize → const Size
- The minimum window size to be considered a desktop device.