Custom Deserialization Adapter

Example:

mixin AuthAdapter on RemoteAdapter<User> {
  Future<String> login(String email, String password) async {
    return sendRequest(
      baseUrl.asUri / 'token',
      method: DataRequestMethod.POST,
      body: json.encode({'email': email, 'password': password}),
      onSuccess: (data) => data['token'] as String,
    );
  }
}

and use it:

final token = await userRepository.authAdapter.login('e@mail, p*ssword');

Also see JSONAPIAdapter for inspiration.