I achieved to resize my images using the package image
What I want to achieve is a conditional statement that reduces the size of the image if image is > than max (1920) and dont resize it otherwise.
This is my code:
Widget build(BuildContext context) {
void uploadImage(File result) async {
var image = decodeImage(result.readAsBytesSync());
var thumbnail = copyResize(image, width: 1920);
var encoded = base64.encode(encodeJpg(thumbnail));
var userAccount =
await context.api.customersApi.accounts.uploadProfileImage(defaultOrganisationId, context.blocs.auth.state.user.id, ImageUploadRequest(encoded));
// update the current user
context.blocs.auth.updateUserAccount(userAccount.data);
}