HttpResponse extension

Extension methods for handling HTTP responses from the Dio package.

Provides convenience methods for parsing the response data into various data types, including JSON models, integers, doubles, numbers, strings, booleans, and date-times.

on
  • Response

Methods

body<T extends JsonModel>() → T

Available on Response, provided by the HttpResponse extension

Converts the response data to a JsonModel object.
bodyAsBoolean() bool

Available on Response, provided by the HttpResponse extension

Converts the response data to a boolean.
bodyAsDateTime() DateTime

Available on Response, provided by the HttpResponse extension

Converts the response data to a DateTime object.
bodyAsDouble() double

Available on Response, provided by the HttpResponse extension

Converts the response data to a double.
bodyAsInteger() int

Available on Response, provided by the HttpResponse extension

Converts the response data to an integer.
bodyAsList<T extends JsonModel>() List<T>

Available on Response, provided by the HttpResponse extension

Converts the response data to a list of JsonModel objects.
bodyAsNumber() num

Available on Response, provided by the HttpResponse extension

Converts the response data to a number.
bodyAsString() String

Available on Response, provided by the HttpResponse extension

Converts the response data to a string.