CommonMiddleware class

Common middleware implementations

Constructors

CommonMiddleware()

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
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

auth({required Future<String?> getUserId(Object? request)}) → Middleware
Authentication middleware
bodyParser() → Middleware
Body parser middleware
compression() → Middleware
Compression middleware
cors({List<String> allowedOrigins = const ['*'], List<String> allowedMethods = const ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], List<String> allowedHeaders = const ['*']}) → Middleware
CORS middleware
csrf({FutureOr<String?> issuedToken(Object? request)?}) → Middleware
CSRF validation middleware.
featureFlags({required Map<String, FutureOr<bool> Function(Object? request)> flags}) → Middleware
Feature-flag middleware.
idempotency({Duration window = const Duration(hours: 24), bool require = false}) → Middleware
Idempotency-key middleware.
locale({List<String> supported = const <String>['en'], String? fallback}) → Middleware
Locale negotiation middleware.
logger() → Middleware
Logging middleware
maintenance({required FutureOr<bool> isDown(), List<String> allowedPaths = const <String>['/health'], String? bypassSecret}) → Middleware
Maintenance-mode middleware.
rateLimit({int maxRequests = 100, Duration window = const Duration(minutes: 1), ClientIdentifier? clientIdentifier, DVCacheAdapter? store, DateTime clock()?}) → Middleware
Rate limiting middleware.
securityHeaders() → Middleware
Security headers middleware
tenant({bool require = false}) → Middleware
Tenant resolution middleware.
timing() → Middleware
Request timing middleware