Custom Deserialization Adapter


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.

Need professional help with Flutter?

Describe your project in detail and include your e-mail and budget.