ApiServiceResponseUtils extension
Utility functions for Either<List<JSON>, JSON>.
Mainly renames the Either methods to be more descriptive for the context of an API service.
Properties
- asJson → JSON
-
Available on Either<
Returns the response as a JSON object.List< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>no setter - asJsonOrNull → JSON?
-
Available on Either<
Returns the response as a JSON object or null if isJson isList< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>false
.no setter -
asList
→ List<
JSON> -
Available on Either<
Returns the response as a list of JSON objects.List< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>no setter -
asListOrNull
→ List<
JSON> ? -
Available on Either<
Returns the response as a list of JSON objects or null if the response is not a list.List< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>no setter - isJson → bool
-
Available on Either<
ReturnsList< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>true
if the response is a JSON object.no setter - isList → bool
-
Available on Either<
ReturnsList< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>true
if the response is a list of JSON objects.no setter
Methods
-
assertJson(
) → void -
Available on Either<
Asserts that isJson isList< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>true
and throws an exception if not. -
assertList(
) → void -
Available on Either<
Asserts that isList isList< , provided by the ApiServiceResponseUtils extensionJSON> , JSON>true
and throws an exception if not.