controller library

Classes

AsyncPatternMatcher<I, O>
Body
Annotate a method parameter to deserialize the HTTP request body. Add a toJson factory method to the class to define how it should be deserialized.
ClosedAsyncPatternMatcher<I, O>
ClosedPatternMatcher<I, O>
ComparisonError
CompositeValidator
Verifies all validators supplied via the constructor and aggregates all validation errors.
Controller
Annotate a class to make it capable of handling HTTP requests. Combine with HttpRequest annotated methods to write request handlers.
Delete
Annotate a method to handle HTTP DELETE requests at the specified path
DispatcherBuilder
EntityValidator
Validates the properties of an object with the property validators specified in the constructor.
Get
Annotate a method to handle HTTP GET requests at the specified path
HasClaim
Check whether the client has a claim with the specified name and value.
Annotate a method to handle HTTP HEAD requests at the specified path
HttpBasicAuthSecurity
HTTP basic authentication security that will read username and password from the Authorization header.
HttpRequest
Annotate a method to handle HTTP requests with the specified method at the specified path
IdentityProvider
Provides identity information for clients
IterableValidator
JwtSecurity
JSON web token authentication security that validates JWT tokens and extracts the client claims from it.
Length
Annotate a request parameter or the property of a request body to validate its length is within the specified range.
LengthError
ListError
Max<C extends Comparable>
Annotate a request parameter or the property of a request body to validate its value is less than or equal to the specified value or expression.
Min<C extends Comparable>
Annotate a request parameter or the property of a request body to validate its value is greater than or equal to the specified value or expression.
NumberError
NumberValidator<N extends num>
ObjectError
Pair<A, B>
Patch
Annotate a method to handle HTTP PATH requests at the specified path
PatternMatcher<I, O>
Post
Annotate a method to handle HTTP POST requests at the specified path
PropertyValidator
Validates the property of a class with all validators specified in the constructor.
Put
Annotate a method to handle HTTP PUT requests at the specified path
Regex
Annotate a request parameter or the property of a request body to validate its value satisfies the specified regular expression.
RegexError
Required
RequiredError
Secured
Annotate a method to protect it with a security check. When the condition returns false, the specified statusCode will be returned instead.
Security
Security handler that verifies security for requests.
SecurityCondition
A security condition for use with @Secured.
SimpleIdentity
SimpleIdentityProvider
Simple identity provider that stores identities in a map in memory.
TransformingPredicate<I, T>
Unique<T>
Annotate a request parameter or the property of a request body to validate its value is unique.
UniqueError
Validatable
Annotate a class to enable validation checks on it
ValidationError
An error created by a validator for an invalid value.
Validator
Annotate a request parameter or the property of a request body to validate it.
ValidJson
ValidJsonError
When
Annotate a request parameter or the property of a request body to apply the wrapped validator conditionally.

Extensions

Operators on Comparable<T>
RequestMatcher on AsyncPatternMatcher<Request, Response>

Constants

body → const Body
controller → const Controller
decimal → const NumberValidator<double>
integer → const NumberValidator<int>
number → const NumberValidator<num>
required → const Required
validatable → const Validatable
validJson → const ValidJson

Properties

corsHeaders Map<String, String>
final
queryRegexp RegExp
final

Functions

always(dynamic entity) bool
asyncMatcher<I, O>() AsyncPatternMatcher<I, O>
convert<T>(dynamic value) → T?
attempts to convert any value to the type T
createRequestDispatcher(List<DispatcherBuilder> dispatcherBuilders, {bool corsEnabled = false, String allowedOrigins = '', Handler defaultHandler = defaultHandler}) RequestDispatcher
defaultHandler(Request request) → Response
identity<T>(dynamic input) → T
matcher<I, O>() PatternMatcher<I, O>
matchRequest(String method, String pathExpression) TransformingPredicate<Request, Future<Pair<Map<String, String>, String>>>
predicate<I, T>(bool predicate(I input), [T transformer(I input)?, String? description]) TransformingPredicate<I, T>

Typedefs

ExistsPredicate<T> = FutureOr<bool> Function(T)
Expression<C> = C Function(dynamic entity)
Predicate<I> = bool Function(I input)
PropertyGetter<E> = dynamic Function(E entity)
RequestDispatcher = FutureOr<Response> Function(Request request)
Transformation<I, O> = O Function(I input)