login function Null safety

Future<Login> login(
  1. String username,
  2. String password
)

Returns the a Login class instance with a JWT session and refresh token for username.

Implementation

Future<Login> login(String username, String password) async {
  var response = await loginResponse(username, password);
  try {
    return Login.fromJson(jsonDecode(response.body));
  } catch (e) {
    throw MangadexServerException(jsonDecode(response.body));
  }
}