refactor, fix capacity handling

This commit is contained in:
mertalev
2026-01-21 02:46:21 -05:00
parent 9980d06f0c
commit cef5a7cf50
14 changed files with 68 additions and 77 deletions
@@ -12,8 +12,13 @@ class RemoteImageRequest extends ImageRequest {
return null;
}
final Map<String, int> info = await remoteImageApi.requestImage(uri, headers: headers, requestId: requestId);
final frame = await _fromEncodedPlatformImage(info["pointer"]!, info["length"]!);
final info = await remoteImageApi.requestImage(uri, headers: headers, requestId: requestId);
final frame = switch (info) {
{'pointer': int pointer, 'length': int length} => await _fromEncodedPlatformImage(pointer, length),
{'pointer': int pointer, 'width': int width, 'height': int height, 'rowBytes': int rowBytes} =>
await _fromDecodedPlatformImage(pointer, width, height, rowBytes),
_ => null,
};
return frame == null ? null : ImageInfo(image: frame.image, scale: scale);
}