This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,17 @@ class Scene extends NativeFieldWrapperClass2 {
3131 if (width <= 0 || height <= 0 ) {
3232 throw Exception ('Invalid image dimensions.' );
3333 }
34- return _futurize ((_Callback <Image > callback) => _toImage (width, height, (_Image image) {
35- callback (Image ._(image));
34+ return _futurize ((_Callback <Image ?> callback) => _toImage (width, height, (_Image ? image) {
35+ if (image == null ) {
36+ callback (null );
37+ } else {
38+ callback (Image ._(image));
39+ }
3640 }),
3741 );
3842 }
3943
40- String ? _toImage (int width, int height, _Callback <_Image > callback) native 'Scene_toImage' ;
44+ String ? _toImage (int width, int height, _Callback <_Image ? > callback) native 'Scene_toImage' ;
4145
4246 /// Releases the resources used by this scene.
4347 ///
Original file line number Diff line number Diff line change @@ -5273,7 +5273,7 @@ typedef _Callback<T> = void Function(T result);
52735273///
52745274/// Return value should be null on success, and a string error message on
52755275/// failure.
5276- typedef _Callbacker <T > = String ? Function (_Callback <T > callback);
5276+ typedef _Callbacker <T > = String ? Function (_Callback <T ? > callback);
52775277
52785278/// Converts a method that receives a value-returning callback to a method that
52795279/// returns a Future.
@@ -5298,7 +5298,7 @@ typedef _Callbacker<T> = String? Function(_Callback<T> callback);
52985298/// ```
52995299Future <T > _futurize <T >(_Callbacker <T > callbacker) {
53005300 final Completer <T > completer = Completer <T >.sync ();
5301- final String ? error = callbacker ((T t) {
5301+ final String ? error = callbacker ((T ? t) {
53025302 if (t == null ) {
53035303 completer.completeError (Exception ('operation failed' ));
53045304 } else {
You can’t perform that action at this time.
0 commit comments