updateUserInfo method
Future<Either<Failure, User?>>
updateUserInfo(
- AuthenticationData authData,
- Map<String, dynamic> userInfo
)
override
Implementation
@override
Future<Either<Failure, User?>> updateUserInfo(
AuthenticationData authData, Map<String, dynamic> userInfo) async {
return wrapAndHandleHttpBaseRequest<User?>(
() {
final body =
config.updateUserInfoCustomRequestMapper?.call(userInfo) ?? jsonEncode(userInfo);
if (config.updateUserInfoApiEndpoint == null) {
throw Exception(
"'updateUserInfoApiEndpoint' property is not defined in provided AccountBasicConfig");
}
final Uri uri = config.updateUserInfoApiEndpoint!(authData);
return http.Request("PATCH", uri)..body = body;
},
onResponse: (response, left, right) {
final user = config.updateUserInfoCustomResponseParser?.call(
jsonDecode(response.body),
);
return right(user);
},
);
}