New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null Safety on exportImage #10
Comments
Thank you for opening up the issue and bringing it to my attention. I will definitely take a look at it. |
I am not able to reproduce the issue. It would be much faster and easier for us to fix the issue if you could provide the following informations.
|
Sorry for the delay. Thanks for the quick reply. Here's my discovery process. Might be a bit verbose, but I want to cover the bases in case I did something wrong. Using Android Studio 4.2.2 (was 4.2.1 when this started)
(Really, a non-issue, since that part will be replaced by loading an actual image)
From the saveImage function:
The
Which then causes an issue with
So, add a null check:
Running again:
Modifying
But introduces an error about
So, modifying 465, as suggested:
Seems to make it all work without complaint. But, again, do not know if it is the right way. |
Flutter 2.5.1, dart 2.14.2 I'm working with this library at the moment and can confirm that I have the same issue as @ccc-dvansevenant. Can also confirm that changing the paint_over_image.dart file (line 464/465) from: final byteData = await (_image.toByteData(format: ui.ImageByteFormat.png)
as FutureOr<ByteData>);
return byteData.buffer.asUint8List(); To: final byteData = await (_image.toByteData(format: ui.ImageByteFormat.png)
as FutureOr<ByteData?>);
return byteData?.buffer.asUint8List(); Does fix the problem. Should I create a PR or are you ok fixing this @lively-bigyan ? |
@dchrzanowski Thank you for the tests and the solution. I am currently working on some new features of the package so I couldn't push the fixes sooner. I shall fix it today. |
On second thought, I just realized that I had it fixed on 0.4.0. Have you guys tried that version? @dchrzanowski @ccc-dvansevenant |
I've had to set aside that part of my project for a while, so I haven't updated anything. I'll try to have a look soon. Thanks! |
@lively-bigyan I did not realize that 0.4.0 was null safety ready. I'll check it out tomorrow morning so. |
0.4.0 works like a charm! Thanks @lively-bigyan! |
Not a problem. Glad it helped. |
Thanks for this library, and starting to migrate it to null safety.
I am using
image_painter: ^1.0.0-nullsafety.0
.My project is set with:
As I was implementing image_painter in my project, I was having issues with
exportImage
.It kept complaining about ByteData, and then buffer. Eventually I hit upon this combination:
Note the last 2 lines, specifically.
I don't know if it's correct or not, but thought I'd pass it along in case it helps.
I'm still learning, very slowly, so it's certainly possible this could be done better.
The text was updated successfully, but these errors were encountered: