RequestMetadata class
Provides HTTP request metadata and utilities.
Constructors
- RequestMetadata(HttpRequest _raw)
Properties
- contentLength → int?
-
Gets content length.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- host → String?
-
Gets host name.
no setter
- ip → String
-
Gets client IP address (handles proxies).
no setter
- isAjax → bool
-
Checks if request is AJAX/XHR.
no setter
- isDelete → bool
-
Checks if request is DELETE.
no setter
- isGet → bool
-
Checks if request is GET.
no setter
- isHead → bool
-
Checks if request is HEAD.
no setter
- isHttp → bool
-
Checks if request is HTTP.
no setter
- isHttps → bool
-
Checks if request is HTTPS.
no setter
- isOptions → bool
-
Checks if request is OPTIONS.
no setter
- isPatch → bool
-
Checks if request is PATCH.
no setter
- isPost → bool
-
Checks if request is POST.
no setter
- isPut → bool
-
Checks if request is PUT.
no setter
- isSecure → bool
-
Checks if request is secure.
no setter
-
metadata
→ Map<
String, dynamic> -
Gets all metadata.
no setter
- method → String
-
Gets HTTP method.
no setter
- origin → String
-
Gets origin (for CORS).
no setter
- path → String
-
Gets request path.
no setter
- port → int?
-
Gets port.
no setter
- protocol → String
-
Gets protocol version.
no setter
-
query
→ Map<
String, String> -
Gets query parameters.
no setter
-
queryKeys
→ Iterable<
String> -
Gets all query parameter keys.
no setter
- referrer → String?
-
Gets referrer.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uri → Uri
-
Gets full URI.
no setter
- userAgent → String?
-
Gets user agent.
no setter
- wantsJson → bool
-
Checks if request wants JSON.
no setter
Methods
-
getMetadata(
String key, [dynamic defaultValue]) → dynamic - Gets custom metadata.
-
getQuery<
T> (String key, {T? defaultValue}) → T? - Gets a query parameter with type conversion.
-
hasQuery(
String key) → bool - Checks if a query parameter exists.
-
isMethod(
String method) → bool - Checks if request method matches.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queryBool(
String key, {bool? defaultValue}) → bool? - Gets a query parameter as boolean.
-
queryDouble(
String key, {double? defaultValue}) → double? - Gets a query parameter as double.
-
queryInt(
String key, {int? defaultValue}) → int? - Gets a query parameter as integer.
-
queryList(
String key, {String separator = ',', List< String> ? defaultValue}) → List<String> ? - Gets a query parameter as list of strings.
-
queryString(
String key, {String? defaultValue}) → String? - Gets a query parameter as string.
-
queryWith<
T> (String key, T? parser(String), {T? defaultValue}) → T? - Gets a query parameter with custom parsing function.
-
setMetadata(
String key, dynamic value) → void - Sets custom metadata.
-
toMap(
) → Map< String, dynamic> - Converts metadata to map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited