ResponseExtension extension
Response extension extends the functionality of the Response
type by
adding a couple of useful methods.
Adds jsonBody getter to get the JSON decoded body of the response.
Adds as method to cast the JSON decoded body as an object of given Type by applying the given transformation function.
Adds asList method to cast the JSON decoded body as a List of the given Type by applying the given transformation function to each item.
- on
-
- Response
Properties
- jsonBody → dynamic
-
JSON decoded
body
of the request, as-is.no setter
Methods
-
as<
T> (T f(Map< String, dynamic> e)) → T - Cast the jsonBody as Type by applying the transformation function.
-
asIterable<
T> (T f(Map< String, dynamic> e)) → Iterable<T> - Cast the jsonBody as a lazy Iterable of Type by applying the transformation function to each underlying item.
-
asList<
T> (T f(Map< String, dynamic> e)) → List<T> - Cast the jsonBody as a List of Type by applying the transformation function to each underlying item.