4Q-s-r-o / signature

Flutter plugin that creates a canvas for writing down a signature
MIT License
255 stars 85 forks source link

'toByteData' isn't defined for the class 'Future<Image>' #2

Closed stevenspiel closed 5 years ago

stevenspiel commented 5 years ago

This is a breaking change as noted here

Here is the error message and backtrace:

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: 'package:signature/signature.dart': error: file:///Users/steven/flutter/.pub-cache/hosted/pub.dartlang.org/signature-1.0.3/lib/signature.dart:201:29: Error: The method 'toByteData' isn't defined for the class 'Future<Image>'.
 - 'Future' is from 'dart:async'.
 - 'Image' is from 'dart:ui'.
Try correcting the name to the name of an existing method, or defining a method named 'toByteData'.
    var bytes = await image.toByteData(format: ImageByteFormat.png);
                            ^^^^^^^^^^
#0      _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#1      _SignaturePainter.export (package:signature/signature.dart:187:27)
#2      SignatureState.exportBytes (package:signature/signature.dart:65:26)
<asynchronous suspension>
#3      Signature.exportBytes (package:signature/signature.dart:34:35)
<asynchronous suspension>
#4      Drawable.build.<anonymous closure> (package:zboviq/pages/shared/drawable.dart:81:74)
#5      _InkRe<…>
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: 'package:signature/signature.dart': error: file:///Users/steven/flutter/.pub-cache/hosted/pub.dartlang.org/signature-1.0.3/lib/signature.dart:201:29: Error: The method 'toByteData' isn't defined for the class 'Future<Image>'.
 - 'Future' is from 'dart:async'.
 - 'Image' is from 'dart:ui'.
Try correcting the name to the name of an existing method, or defining a method named 'toByteData'.
    var bytes = await image.toByteData(format: ImageByteFormat.png);
                            ^^^^^^^^^^
#0      _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#1      _SignaturePainter.export (package:signature/signature.dart:187:27)
#2      SignatureState.exportBytes (package:signature/signature.dart:65:26)
<asynchronous suspension>
#3      Signature.exportBytes (package:signature/signature.dart:34:35)
<asynchronous suspension>
#4      Drawable.build.<anonymous closure> (package:zboviq/pages/shared/drawable.dart:81:74)
#5      _InkRe<…>
stevenspiel commented 5 years ago

This is how another person solved the issue

ethael commented 5 years ago

hello. thanks a lot. we will resolve this problem this week

MartinHlavna commented 5 years ago

Released as version 1.1.0

MSatyam-Mishra commented 1 year ago

is it not fixed yet? coz I am getting this error " The method 'toByteData' isn't defined for the type 'Future'."