TrayRequest<T> class

Constructors

TrayRequest({String url = '/', Map<String, String?>? params, TrayRequestBody? body, MakeRequestMethod method = MakeRequestMethod.get, Map<String, String>? headers})

Properties

body TrayRequestBody?
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
final
method MakeRequestMethod
final
overwriteParams Map<String, String?>
getter/setter pair
params Map<String, String?>?
final
result ↔ T?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
final

Methods

afterSuccess(TrayRequestResponse result) → void
this is a hook, that can be overwritten to perform actions, after the request has been done successfully
generateMetaData<RequestType extends TrayRequest, MetadataType extends TrayRequestMetadata>(RequestType request, dynamic responseJson) → dynamic
getBody() → dynamic
returns the request body object
getEnvironment() TrayEnvironment
returns the fetch hook client used for this request
getHeaders() Future<Map<String, String>>
returns the combined headers from this request and client
getModelFromJson(dynamic json) → dynamic
a method, that takes a json input and returns the result method for a single entry
getParams([Map<String, String?> requestParams = const {}]) Future<Map<String, String>>
a method that allows us to customize even complex params generations by default, we just return the params passed to the request here.
getParamsRaw([Map<String, String?> customParams = const {}]) Map<String, String>
a method that allows us to customize even complex params generations by default, we just return the params passed to the request here.
getUrl() Future<String>
a method that allows us to customize even complex url generations by default, we just return the url passed to the request here.
getUrlWithParams() Future<String>
parses the params and makes sure they are either inserted into the path (if used like /user/:var1/:var2/) or if not defined there, they will be added as query params
mergePaginatedResults(T currentData, T newData) → T
Defines the way paginated results should be combined This method should be implemented in the request itself. This is just a fallback, to throw an error if not implemented correctly.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pagination<RequestType extends TrayRequest>(RequestType request) FetchTrayPaginationDriver<RequestType, T>
A method to access the pagination provider defined for this request The provider contains normalized pagination methods like fetchMore, ...
toString() String
A string representation of this object.
inherited

Operators

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