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
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 therequestDebugLevel
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
anderrors
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