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.
const
factory
ApiResultBody.json(Object data)
Container for a response body that came with the "application/json" content type. For detail endpoints, data is expected to either be a Map or a List of Maps, of length 1. For list endpoints, data is 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.
const
factory
ApiResultBody.plainText(String text)
Container for a response body that came with the "text/plain" content type.
const
factory

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

A switch-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 of map that fallback to returning null.
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 of map that fallback to returning orElse.
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 of when that fallback to an orElse callback.
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

A switch-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 of when that fallback to returning null

Operators

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