Response class abstract

This abstract class represents the common elements of the entity objects corresponding to the Duolingo API.

This abstract class manages the following information.

  1. status -> HTTP status included in the response returned by the API.
  2. headers -> Headers included in the response returned by the API.

If you want to check the HTTP status and header information of the response after calling a method of Duolingo4D, you can refer to the entity object that inherits from this abstract class.

Example:

void main() async {
  final duolingo = Duolingo.instance;

  final authResponse = await duolingo.authenticate(
    username: 'test_username',
    password: 'test_password',
  );

  if (authResponse.status.isNotOk) {
    authResponse.status.reasonPhrase;
    authResponse.headers;
    return;
  }
}
Implementers

Constructors

Response.from({required Status status, required Map<String, String> headers})
Returns the new instance of Response based on arguments.

Properties

hashCode int
The hash code for this object.
no setteroverride
headers Map<String, String>
The http headers
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status Status
The http status
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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