From 4d5144570f990139bd2088db4cae79e79928f580 Mon Sep 17 00:00:00 2001 From: Harry Terkelsen Date: Mon, 6 Jan 2020 11:17:18 -0800 Subject: [PATCH] Throw an exception in `Image.toByteData` rather than hang forever. --- lib/web_ui/lib/src/engine/html_image_codec.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/web_ui/lib/src/engine/html_image_codec.dart b/lib/web_ui/lib/src/engine/html_image_codec.dart index 3ccd1faf11cb9..18a109b6697cd 100644 --- a/lib/web_ui/lib/src/engine/html_image_codec.dart +++ b/lib/web_ui/lib/src/engine/html_image_codec.dart @@ -129,6 +129,11 @@ class HtmlImage implements ui.Image { } } + // TODO(het): Support this for asset images and images generated from + // `Picture`s. /// Returns an error message on failure, null on success. - String _toByteData(int format, Callback callback) => null; + String _toByteData(int format, Callback callback) { + callback(null); + return 'Image.toByteData is not supported in Flutter for Web'; + } }