addResizedImage method
Implementation
Future<void> addResizedImage(
final String key,
final int? width,
final int? height,
) async {
if (state.uiImages.isEmpty ||
isAnimatedImage ||
state.uiImages.containsKey(key)) return;
final tWidth = getTargetSize(width, imageInfo.width!);
final tHeight = getTargetSize(height, imageInfo.height!);
final completer = Completer<_ImageResolverResult>();
_ImageDecoder.schedule(
bytes: imageInfo.imageBytes!,
completer: completer,
height: tHeight,
width: tWidth,
);
final result = await completer.future;
if (mounted) {
state.uiImages.putIfAbsent(key, () => result.image);
state = state.copyWith(isLoading: false);
} else {
result.image.dispose();
}
}