EngineConfig class

Primary configuration for the routing engine.

This class consolidates all engine settings including features, security, routing behavior, TLS, and view configuration. It provides the main configuration interface for customizing engine behavior.

Example:

final config = EngineConfig(
  security: EngineSecurityFeatures(
    maxRequestSize: 10 * 1024 * 1024,
    cors: CorsConfig(enabled: true),
  ),
  redirectTrailingSlash: true,
  handleMethodNotAllowed: true,
);
Implemented types

Constructors

EngineConfig({EngineFeatures? features, EngineSecurityFeatures? security, ViewConfig? views, bool? redirectTrailingSlash, bool? redirectFixedPath, bool? handleMethodNotAllowed, bool? removeExtraSlash, bool? useRawPath, bool? unescapePathValues, int? pathInternCacheSize, bool? forwardedByClientIP, List<String>? remoteIPHeaders, List<String>? trustedProxies, String? trustedPlatform, String? templateDirectory, bool? defaultOptionsEnabled, EtagStrategy? etagStrategy, dynamic templateEngine, String? appKey, FileSystem? fileSystem, MultipartConfig? multipart, ShutdownConfig? shutdown, Http2Config? http2, String? tlsCertificatePath, String? tlsKeyPath, String? tlsCertificatePassword, bool? tlsRequestClientCertificate, bool? tlsShared, bool? tlsV6Only})
Creates an engine configuration with the given settings.

Properties

appKey String?
Application key used by providers that need a signing secret.
final
defaultOptionsEnabled bool
Whether the engine automatically responds to OPTIONS requests.
final
etagStrategy EtagStrategy
Entity-tag generation strategy.
final
features EngineFeatures
Feature flags controlling platform, proxy, and routing behavior.
final
fileSystem → FileSystem
File system used for template and upload access.
final
forwardedByClientIP bool
Whether forwarded headers are used to determine the client address.
final
handleMethodNotAllowed bool
Whether matching paths with an unsupported method return 405.
final
hashCode int
The hash code for this object.
no setterinherited
http2 Http2Config
HTTP/2 protocol settings.
final
multipart MultipartConfig
Multipart upload limits and storage settings.
final
pathInternCacheSize int
Maximum number of normalized paths retained in the intern cache.
final
redirectFixedPath bool
Whether fixed-path normalization redirects are enabled.
final
redirectTrailingSlash bool
Whether routes may redirect between trailing-slash forms.
final
remoteIPHeaders List<String>
Header names checked for forwarded client addresses.
final
removeExtraSlash bool
Whether repeated slashes are removed during path normalization.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
security EngineSecurityFeatures
Security headers, request limits, and CORS settings.
final
shutdown ShutdownConfig
Graceful shutdown settings.
final
templateDirectory String
Directory containing application templates.
final
templateEngine → dynamic
Optional template engine instance supplied by the application.
final
tlsCertificatePassword String?
Password used to unlock the TLS certificate, when required.
final
tlsCertificatePath String?
Path to the TLS certificate file.
final
tlsKeyPath String?
Path to the TLS private key file.
final
tlsRequestClientCertificate bool?
Whether the TLS server requests a client certificate.
final
tlsShared bool?
Whether the TLS server allows shared listening sockets.
final
tlsV6Only bool?
Whether the TLS listener is restricted to IPv6-only connections.
final
trustedPlatform String?
The configured platform name used for trusted client-address headers. The platform whose forwarded client-IP headers are trusted.
getter/setter pair
trustedProxies List<String>
The configured trusted proxy network strings.
getter/setter pair
unescapePathValues bool
Whether percent-encoded path parameter values are decoded.
final
useRawPath bool
Whether the raw request path is used instead of the decoded path.
final
views ViewConfig
View-template loading settings.
final

Methods

copyWith({EngineFeatures? features, EngineSecurityFeatures? security, ViewConfig? views, bool? redirectTrailingSlash, bool? redirectFixedPath, bool? handleMethodNotAllowed, bool? removeExtraSlash, bool? useRawPath, bool? unescapePathValues, int? pathInternCacheSize, bool? forwardedByClientIP, List<String>? remoteIPHeaders, List<String>? trustedProxies, String? trustedPlatform, String? templateDirectory, dynamic templateEngine, String? appKey, bool? defaultOptionsEnabled, EtagStrategy? etagStrategy, FileSystem? fileSystem, MultipartConfig? multipart, ShutdownConfig? shutdown, Http2Config? http2, String? tlsCertificatePath, String? tlsKeyPath, String? tlsCertificatePassword, bool? tlsRequestClientCertificate, bool? tlsShared, bool? tlsV6Only}) EngineConfig
Creates a copy of this config with the specified fields replaced with new values.
ensureTrustedProxiesParsed() Future<void>
Ensures configured trusted proxy networks have been parsed.
isTrustedProxy(InternetAddress addr) bool
Checks if the given InternetAddress is a trusted proxy.
isTrustedProxyText(String address) bool
Checks a textual address against trusted proxy networks.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseTrustedProxies() Future<void>
Parses trusted proxy networks without requiring socket APIs for IP/CIDR values. Hostname proxies retain Dart IO DNS lookup support when available.
toString() String
A string representation of this object.
inherited
validate(ConfigValidationContext context) → void
Creates a ValidatableConfiguration.
override

Operators

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

Constants

platformCloudflare → const String
Cloudflare's client IP header name.
platformFlyIO → const String
Fly.io's client IP header name.
platformGoogleAppEngine → const String
Google App Engine's client IP header name.