appwrite / sdk-for-dart

[READ-ONLY] Official Appwrite Dart SDK πŸ’™
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
113 stars 17 forks source link

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

Closed obiwanzenobi closed 1 year ago

obiwanzenobi commented 1 year ago

πŸ‘Ÿ 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?

🏒 Have you read the Code of Conduct?

stnguyen90 commented 1 year ago

@obiwanzenobi thanks for raising this! πŸ™πŸΌ This actually looks like a duplicate of https://github.com/appwrite/appwrite/issues/5661 so I'm going to close this. Please πŸ‘πŸΌ the related issue.