updateProfile method
Updates the profile on the server using the configured profileUpdateUrl.
Implementation
Future<CkAuthResult<TProfile?>> updateProfile({
Map<String, dynamic>? formFields,
Map<String, dynamic>? files,
Map<String, dynamic>? jsonBody,
}) {
return loadingController.wrap(CkAuthLoadingType.updateProfile, () async {
if (config.mockAuth) {
return const CkAuthResult.success(data: null, statusCode: 200);
}
final result = await _profileExtractor.updateProfileRemote(
url: config.endpoints.updateProfile,
method: config.endpoints.updateProfileMethod,
formFields: formFields,
files: files,
jsonBody: jsonBody,
);
if (result.isSuccess) {
final fetchResult = await fetchProfile();
if (fetchResult.isSuccess && fetchResult.data != null) {
return CkAuthResult.success(
data: fetchResult.data,
statusCode: result.statusCode,
rawResponse: result.rawResponse,
);
}
}
return result;
});
}