David PHAM-VAN

ImageProvider.resolve returns non-null object

... ... @@ -7,6 +7,7 @@
- Add individual cell decoration
- Improve Bullet Widget
- Use covariant on SpanningWidget
- ImageProvider.resolve returns non-null object
## 3.2.0
... ...
... ... @@ -53,7 +53,7 @@ class DecorationImage extends DecorationGraphic {
@override
void paint(Context context, PdfRect box) {
final _image = image.resolve(context, box.size, dpi: dpi)!;
final _image = image.resolve(context, box.size, dpi: dpi);
final imageSize =
PdfPoint(_image.width.toDouble(), _image.height.toDouble());
... ...
... ... @@ -121,7 +121,7 @@ class Image extends Widget {
_paintImage(
canvas: context.canvas,
image: image.resolve(context, rect.size, dpi: dpi)!,
image: image.resolve(context, rect.size, dpi: dpi),
rect: box!,
alignment: alignment,
fit: fit,
... ...
... ... @@ -51,7 +51,7 @@ abstract class ImageProvider {
/// Resolves this image provider using the given context, returning a PdfImage
/// The image is automatically added to the document
PdfImage? resolve(Context context, PdfPoint size, {double? dpi}) {
PdfImage resolve(Context context, PdfPoint size, {double? dpi}) {
final effectiveDpi = dpi ?? this.dpi;
if (effectiveDpi == null || _cache[0] != null) {
... ... @@ -59,7 +59,7 @@ abstract class ImageProvider {
assert(_cache[0]!.pdfDocument == context.document,
'Do not reuse an ImageProvider object across multiple documents');
return _cache[0];
return _cache[0]!;
}
final width = (size.x / PdfPageFormat.inch * effectiveDpi).toInt();
... ... @@ -71,7 +71,7 @@ abstract class ImageProvider {
assert(_cache[width]!.pdfDocument == context.document,
'Do not reuse an ImageProvider object across multiple documents');
return _cache[width];
return _cache[width]!;
}
}
... ...