Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Flutter stable 1.17.x incompatible - exception thrown #158

Open
ninnepinne opened this issue Jun 2, 2020 · 3 comments
Open

Flutter stable 1.17.x incompatible - exception thrown #158

ninnepinne opened this issue Jun 2, 2020 · 3 comments

Comments

@ninnepinne
Copy link
Contributor

ninnepinne commented Jun 2, 2020

Hello (again) and thank you for your work.

Since upgrading to 1.17 stable I have experienced crashes when images failed to load.

Investigated and found out that the reason is the new breaking changes to ImageProvider in 1.17.

The bug can be reproduced with latest version 0.7.0 by using a TransitionToImage with a AdvancedNetworkImage as provider.

If you for example use the plugin to display an image in a list with a builder and the widget is scrolled off and disposed and the image load fails - the result will be an exception.

This error will propagate...
return Future.error(StateError('Failed to load $url.'));
...and if TransitionToImage has been disposed

@override
  void dispose() {
    _imageStream.removeListener(
        ImageStreamListener(_updateImage, onError: _catchBadImage));
    _controller.dispose();
    super.dispose();
  }

No error handlers
_catchBadImage

will be registered and an unhandled error will propagate...

So loading a list of images with flaky network (or failing urls) while scrolling will produce a lot of unhandled exceptions.

I pinned down the solution to the problem to the new error handling in the 1.17.x version of ImageProvider where even the unhandled, parentless load error is handled by the ImageProvider (via a safe zone).

I was preparing a pull request from my locally modified flutter_advanced_networkimage.dart when I discovered that the master branch has already been updated to the 1.17 new version of ImageProvider (the resolve() method removed).

I have tried my app with the master branch version - and no exceptions are thrown

I would very much appreciate a release of 0.8.0 since 0.7.0 is not compatible with the latest stable Flutter release 1.17.x (and it seems like you have already done the work).

Please reach out if there is anything I can do to help.

Thank you!

@ninnepinne
Copy link
Contributor Author

@mchome How confident are you of the master branch's current state?
Are there unfinished stuff in there?
It seems to work fine.
I need to do a release now, with a fix.
Not sure if I should release with master (upcoming 0.8.0 state) or a modded 0.7.0.
Thanks again.

@mchome
Copy link
Owner

mchome commented Jun 3, 2020

The test cases are passed, and you feel it works good, it should be fine.
My http client does not imported by image provider.

@ninnepinne
Copy link
Contributor Author

Ok, thanks.

My http client does not imported by image provider.

Not really sure what you mean...

AdvancedNetworkImage is a subclass of ImageProvider...

This is the change: https://flutter.dev/docs/release/breaking-changes/image-cache-and-provider

And the master branch has these adaptations.

And 0.7.0 is incompatible with 1.17.x stable Flutter if using TransitionToImage (in the way described above).

So a release of 0.8.0 would probably be good thing.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants