updateChatAvatar method
- PlatformFile? image, {
- CropAreaInput? crop,
Updates the Chat.avatar with the provided image
, or resets it to
null
.
Implementation
Future<void> updateChatAvatar(
PlatformFile? image, {
CropAreaInput? crop,
}) async {
avatarUpload.value = RxStatus.loading();
try {
await _chatService.updateChatAvatar(
chatId,
file: image == null ? null : NativeFile.fromPlatformFile(image),
crop: crop,
);
avatarUpload.value = RxStatus.empty();
} on UpdateChatAvatarException catch (e) {
avatarUpload.value = RxStatus.error(e.toMessage());
} catch (e) {
avatarUpload.value = RxStatus.empty();
MessagePopup.error(e);
rethrow;
}
}