Skip to content
Back

Storage file preview broken on Flutter SDK

  • 0
  • Self Hosted
  • Flutter
  • Storage
darkmess
8 Mar, 2024, 18:32

Using output: ImageFormat.webp on file preview causes a crash

TL;DR
Developers are facing issues with storage file preview in Flutter SDK due to errors with enums. When using `output: ImageFormat.webp` in the code, it triggers a crash with the error message `type 'ImageFormat' is not a subtype of type 'Iterable<dynamic>'`. The problem seems to be related to the new enums causing the API request to not be sent. Solution: The developers need to address this issue by reviewing and fixing the compatibility between 'ImageFormat' and 'Iterable<dynamic>' for the file preview functionality.
Steven
8 Mar, 2024, 18:47

i thought you brought this up before already 🧐

darkmess
8 Mar, 2024, 18:48

This is the code

TypeScript
        bucketId: e.bucketId,
        fileId: e.fileId,
        height: e.height?.toInt(),
        width: e.width?.toInt(),
        output: ImageFormat.webp,
        quality: 75,
      );```

this is the stacktrace

```I/flutter (11114): type 'ImageFormat' is not a subtype of type 'Iterable<dynamic>'
I/flutter (11114): #0      _Uri._makeQueryFromParametersDefault.<anonymous closure> (dart:core/uri.dart:2382:18)
I/flutter (11114): #1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
I/flutter (11114): #2      _Uri._makeQueryFromParametersDefault (dart:core/uri.dart:2378:21)
I/flutter (11114): #3      _Uri._makeQueryFromParameters (dart:core-patch/uri_patch.dart:85:12)
I/flutter (11114): #4      _Uri._makeQuery (dart:core/uri.dart:2353:12)
I/flutter (11114): #5      new _Uri (dart:core/uri.dart:1654:13)
I/flutter (11114): #6      ClientMixin.prepareRequest (package:appwrite/src/client_mixin.dart:52:13)
I/flutter (11114): #7      ClientIO.call (package:appwrite/src/client_io.dart:370:32)
I/flutter (11114): #8      Storage.getFilePreview (package:appwrite/services/storage.dart:217:30)```
darkmess
8 Mar, 2024, 18:48

No that's different

darkmess
8 Mar, 2024, 18:49

this is broken because of the new enums

darkmess
8 Mar, 2024, 18:49

the api request doesn't even get sent

Steven
8 Mar, 2024, 18:49

ahh i see

Steven
8 Mar, 2024, 18:56

would you please create an issue for this?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more