updateUsername method
Future<Either<Failure, User?> >
updateUsername(
- AuthenticationData authData,
- String username
override
Implementation
@override
Future<Either<Failure, User?>> updateUsername(AuthenticationData authData, String username) async {
return wrapAndHandleHttpBaseRequest<User?>(
() {
final uri = config.updateUsernameApiEndpoint!.call(authData);
final body = config.updateUsernameCustomRequestMapper?.call(username) ??
jsonEncode({
'username': username,
});
final method = config.updateUsernameApiEndpointMethod ?? "PATCH";
logger.d("requesting update username at: $uri ");
return http.Request(method, uri)..body = body;
},
onResponse: (response, left, right) {
final user = config.updateUsernameCustomResponseParser?.call(
response,
);
return right(user);
},
);
}