ApiResultBody class sealed
Typed-container for the response payload for an ApiResult.
- Available extensions
- Annotations
-
- @Freezed.new()
Constructors
- ApiResultBody.html(String html)
-
Container for a response body that came with the "text/html" content type.
constfactory
- ApiResultBody.json(Object data)
-
Container for a response body that came with the "application/json"
content type. For detail endpoints,
datais expected to either be a Map or a List of Maps, of length 1. For list endpoints,datais expected to either be a List of Maps, or a Map with a single key which points to a List of Maps. This special key should be specified by the ApiSource.resultsKey value.constfactory - ApiResultBody.plainText(String text)
-
Container for a response body that came with the "text/plain" content type.
constfactory
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
-
map<
TResult extends Object?> ({required TResult html(HtmlApiResultBody value), required TResult json(JsonApiResultBody value), required TResult plainText(PlainTextApiResultBody value)}) → TResult -
Available on ApiResultBody, provided by the ApiResultBodyPatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> ({TResult? html(HtmlApiResultBody value)?, TResult? json(JsonApiResultBody value)?, TResult? plainText(PlainTextApiResultBody value)?}) → TResult? -
Available on ApiResultBody, provided by the ApiResultBodyPatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> ({TResult html(HtmlApiResultBody value)?, TResult json(JsonApiResultBody value)?, TResult plainText(PlainTextApiResultBody value)?, required TResult orElse()}) → TResult -
Available on ApiResultBody, provided by the ApiResultBodyPatterns extension
A variant ofmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> ({TResult html(String html)?, TResult json(Object data)?, TResult plainText(String text)?, required TResult orElse()}) → TResult -
Available on ApiResultBody, provided by the ApiResultBodyPatterns extension
A variant ofwhenthat fallback to anorElsecallback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult html(String html), required TResult json(Object data), required TResult plainText(String text)}) → TResult -
Available on ApiResultBody, provided by the ApiResultBodyPatterns extension
Aswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> ({TResult? html(String html)?, TResult? json(Object data)?, TResult? plainText(String text)?}) → TResult? -
Available on ApiResultBody, provided by the ApiResultBodyPatterns extension
A variant ofwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited