mchome / flutter_advanced_networkimage

flutter advanced network image provider
https://pub.dev/packages/flutter_advanced_networkimage
MIT License
285 stars 180 forks source link

App Crashes after a few seconds #120

Closed florent-huran closed 4 years ago

florent-huran commented 5 years ago

I attempted to use the library in a personal project and I experience a weird issue.

After a few seconds, if I went through approximately 5-6 product views (which contains 2 pictures of approximately 1-2Mo each), the app crashes, without any log.

Here is my integration:

@override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Center(
          child: TransitionToImage(
            image: AdvancedNetworkImage(
              imageURL,
              retryLimit: 3,
              useDiskCache: true,
              cacheRule: CacheRule(
                maxAge: const Duration(days: 7),
              ),
            ),
            loadingWidgetBuilder: (context, _, __) =>
                CircularProgressIndicator(),
            fit: BoxFit.contain,
            placeholder: Container(),
            enableRefresh: true,
          ),
        )
      ],
    );
  }

I managed to catch an Exception just before a crash though:

The following _Exception was thrown resolving an image frame:
Exception: operation failed

When the exception was thrown, this was the stack: 
#0      MultiFrameImageStreamCompleter._decodeNextFrameAndSchedule (package:flutter/src/painting/image_stream.dart:680:20)
<asynchronous suspension>
#1      MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart:644:7)
#10     AdvancedNetworkImage._loadAsync (package:flutter_advanced_networkimage/src/provider/flutter_advanced_networkimage.dart)
<asynchronous suspension>
...
Image provider: AdvancedNetworkImage("https://mysterytea.fr/wp-content/uploads/2018/08/LeverDuSoleilBackProduct.jpg",scale: 1.0,header: null,useDiskCache: true,retryLimit: 3,retryDuration: 0:00:00.500000,retryDurationFactor: 1.5,timeoutDuration: 0:00:05.000000)
Image key: AdvancedNetworkImage("https://mysterytea.fr/wp-content/uploads/2018/08/LeverDuSoleilBackProduct.jpg",scale: 1.0,header: null,useDiskCache: true,retryLimit: 3,retryDuration: 0:00:00.500000,retryDurationFactor: 1.5,timeoutDuration: 0:00:05.000000)
aeoriwnd commented 5 years ago

Same issue here. Makes plugin unusable

florent-huran commented 5 years ago

I decided to use another library instead: https://pub.dev/packages/cached_network_image

It’s enough for my needs

I may be wrong, but I think these two plugins don’t use the same base for caching feature. cached_network_image uses sqflite

It may be because of that or not, I honestly don’t know

aeoriwnd commented 5 years ago

Hey, thanks for the recommendation!

mchome commented 4 years ago

Exception: operation failed should be flutter's decode error :/