TrayEnvironment class

The client providing default data to every request being made with it

If debugLevel defines how much should be logged for development support purposes

Constructors

TrayEnvironment({String baseUrl = '', Map<String, String>? headers, Map<String, String>? params, FetchTrayDebugLevel debugLevel = FetchTrayDebugLevel.errorsAndWarnings})

Properties

baseUrl String
final
debugLevel FetchTrayDebugLevel
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
final
params Map<String, String>?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getCombinedHeaders(Map<String, String>? requestHeaders) Map<String, String>
merges custom request headers into the the headers here and returns a combined map of headers, where custom headers override default ones
getCombinedParams(Map<String, String>? requestParams) Map<String, String>
merges custom request params into the the params here and returns a combined map of params, where custom params override default ones
matchesDebugLevels({FetchTrayLogLevel logType = FetchTrayLogLevel.info, FetchTrayDebugLevel requestDebugLevel = FetchTrayDebugLevel.everything}) bool
Compares the logType to the requestDebugLevel to find out whether a debug Info should be shown for this combination or not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseErrorDetails(TrayRequest request, Response response, Map<String, dynamic> errorBodyJson, {Map<String, dynamic>? debugInfo}) TrayRequestError
This method is used to parse the output of failing requests we need a way to retrieve the error message and error details if you don't use the default message and errors key, in your api, you can overwrite the mapping here and make sure everything is passed correctly
showDebugInfo({FetchTrayLogLevel logType = FetchTrayLogLevel.info, FetchTrayDebugLevel? localDebugLevel}) bool
lets us easily find out whether to show a specific logType message or not
toString() String
A string representation of this object.
inherited

Operators

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