HttpRequestBuilder class

Builds an HttpRequestSpec from a HttpRule (parsed from google.api.http), a baseUrl, and the request message represented as a JSON-like Map<String, dynamic>.

Field-handling rules (mirroring the official google.api.http semantics):

  1. Every field referenced by a {field} or {field=pattern} path variable is removed from the "remaining" field set and substituted into the URL, URL-encoded. Nested fields use dotted paths ({user.address.city}) resolved against nested maps. Wildcard patterns (*, **) only affect how many literal slashes the substituted value is allowed to contain conceptually — for request building we simply insert the value, optionally re-splitting on '/' for ** so existing slash-separated values aren't double-encoded.
  2. If body is "*", every field NOT used in the path becomes part of the JSON body, and there are no query params.
  3. If body is a specific field name, that single field's value (after removing path fields from it, if it's a nested message — rare in practice) becomes the JSON body, and all other remaining fields become query parameters.
  4. If body is null/absent (typical for GET/DELETE), there is no body; every remaining field becomes a query parameter. Nested message/map fields are flattened using dotted notation (filter.name=foo) the same way google.api.http does for query params; repeated fields produce repeated key=value pairs.

Constructors

HttpRequestBuilder()

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

build({required HttpRule rule, required Map<String, dynamic> message}) HttpRequestSpec