Skip to content

Exception: download-size-exceeded #58

@SergioSanchezHypefive

Description

@SergioSanchezHypefive

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions