Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Exception: download-size-exceeded #58

Open
SergioSanchezHypefive opened this issue Jan 21, 2022 · 0 comments
Open

Exception: download-size-exceeded #58

SergioSanchezHypefive opened this issue Jan 21, 2022 · 0 comments

Comments

@SergioSanchezHypefive
Copy link

SergioSanchezHypefive commented Jan 21, 2022

The plugin throws an exception even though I'm setting maxSizeBytes to 10MB.

This is the complete output:

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(download-size-exceeded, Size of the downloaded file exceeds the amount of memory allocated for the download., {code: download-size-exceeded, message: Size of the downloaded file exceeds the amount of memory allocated for the download., nativeErrorMessage: Attempted to download object with size of 8433073 bytes, which exceeds the maximum size of 2500000 bytes. Consider raising the maximum download size, or using [FIRStorageReference writeToFile:], nativeErrorCode: -13032}, null)

And this is the widget:

Container(
   margin: const EdgeInsets.only(top: 15),
   height: 250,
   width: double.infinity,
   decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(15),
      image: DecorationImage(
         image: FirebaseImage(
            path,
            cacheRefreshStrategy: CacheRefreshStrategy.NEVER, // Switch off update checking
            maxSizeBytes: MAX_SIZE_BYTES, // 10MB max file size (default: 2.5MB)
         ),
         fit: BoxFit.cover,
       ),
    ),
);

Edit:
Solved. I was precaching the image in initState and needed to add the maxSizeBytes argument there too:

  @override
  void initState() {
    super.initState();
    FirebaseImage(
      path,
      cacheRefreshStrategy: CacheRefreshStrategy.NEVER, // Switch off update checking
      maxSizeBytes: MAX_SIZE_BYTES, // 10MB max file size (default: 2.5MB)
    ).preCache();
  }

Question: Isn't it redundant to create the same widget twice?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant