未验证 提交 c4628b70 编写于 作者: J Jason Simmons 提交者: GitHub

Complete Picture.toImage futures with an exception if the image is null (#25058)

上级 79a8d36e
......@@ -4879,13 +4879,17 @@ class Picture extends NativeFieldWrapperClass2 {
if (width <= 0 || height <= 0)
throw Exception('Invalid image dimensions.');
return _futurize(
(_Callback<Image> callback) => _toImage(width, height, (_Image image) {
callback(Image._(image));
(_Callback<Image?> callback) => _toImage(width, height, (_Image? image) {
if (image == null) {
callback(null);
} else {
callback(Image._(image));
}
}),
);
}
String? _toImage(int width, int height, _Callback<_Image> callback) native 'Picture_toImage';
String? _toImage(int width, int height, _Callback<_Image?> callback) native 'Picture_toImage';
/// Release the resources used by this object. The object is no longer usable
/// after this method is called.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册