Middleware that can be written as a const expression.
middleware: on @Controller and on a verb only accepts const values, so
there has to be a way to get from one of those to a shelf Middleware.
Dust emits const RateLimit(perMinute: 30).toMiddleware(). The name follows
axum's Layer, and Router.layer takes either this or a bare shelf
Middleware.
final class RateLimit implements Layer {
const RateLimit({required this.perMinute});
final int perMinute;
@override
Middleware toMiddleware() => ...;
}
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMiddleware(
) → Middleware - Builds the shelf middleware this value configures.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited