Closed anbarasannethaji closed 1 month ago
That's not an issue with riverpod. It's an issue with how copy with works. Prefer using freezed as it caters for this situation.
Here's how copyWith works:
TryState copyWith({File? imageFile, File? imageLogo}) {
return TryState(
imageFile: imageFile ?? this.imageFile,
imageLogo: imageLogo ?? this.imageLogo,
);
}
if you pass null to the imageFile, the new TryState object created will have the current imageFile. The check translates to this kind of pseudocode
if (imageFile != null) {
imageFile;
} else {
currentImageFile;
}
Indeed, that is unrelated to Riverpod. Your copyWith does not support assigning null values.
when image is add from gallery its not removing even when i give null value to copyWith
image is not removing from UI