appwrite/sdk-for-dart

๐Ÿ› Bug Report: type '_Map<String, dynamic>' is not a subtype of type 'List<dynamic>'

obiwanzenobi opened this issue ยท 1 comments

๐Ÿ‘Ÿ Reproduction steps

While creating collection, some combination of permissions causes server to respond with a wrong type for "permissions" which leads to SDK crash.
https://github.com/appwrite/sdk-for-dart/blob/master/lib/src/models/collection.dart#L12 and https://github.com/appwrite/sdk-for-dart/blob/master/lib/src/models/collection.dart#L44

Wrong response:
{"$id":"category","$createdAt":"2023-06-08T12:45:14.832+00:00","$updatedAt":"2023-06-08T12:45:14.832+00:00","$permissions":{"0":

Screenshot 2023-06-08 at 14 40 54

๐Ÿ‘ Expected behavior

SDK should handle both response types array and object OR server should be consistent with a response structure.

๐Ÿ‘Ž Actual Behavior

SDK handles response only while permissions field is an array.

๐ŸŽฒ Appwrite version

Different version (specify in environment)

๐Ÿ’ป Operating system

Linux

๐Ÿงฑ Your Environment

Local selfohosted appwrite 1.3.4

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

@obiwanzenobi thanks for raising this! ๐Ÿ™๐Ÿผ This actually looks like a duplicate of appwrite/appwrite#5661 so I'm going to close this. Please ๐Ÿ‘๐Ÿผ the related issue.