RequestData class

Request object, internally used by the library. The network request app makes is broken down into pieces to be used by the library. You can also modify the RequestData before the request is made For Example, if you want to wrap your data in a particular structure before sending, or you want every request header to have Content-Type set to application/json.

class Logger extends MiddlewareContract {
  @override
  void interceptRequest(RequestData data) {
  //Adding content type to every request
    data.headers["Content-Type"] = "application/json";

    data.body = jsonEncode({
      uniqueId: "some unique id",
      data: data.body,
    });
  }
  @override
  void interceptResponse(ResponseData data) {
  }
  @override
  void interceptError(err) {
  }
}

Constructors

RequestData({required Method method, required Uri url, Map<String, String>? headers, dynamic body, Encoding? encoding})

Properties

body ↔ dynamic
getter/setter pair
encoding Encoding?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
getter/setter pair
method Method
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url Uri
getter/setter pair

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