Back

[SOLVED] Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'List<dynamic>'

  • 0
  • Flutter
Said H
15 Sep, 2023, 01:27

Hello, I'm using AppWrite cloud and I hit this error when querying from a collection. I was able to query from other collection. I browsed Discord and tried to apply some suggestions, such as changing the cast to void and dynamic. Both are not working. Would you have any suggestion?

TypeScript
  Future<DocumentList> getDocs(collectionId) {
    return databases.listDocuments(
      databaseId: appwriteDatabaseId,
      collectionId: collectionId,
    );
  }

I am using appwrite: ^9.0.1

TL;DR
The user encountered an error when querying from a collection in AppWrite cloud. They tried changing the cast to 'void' and 'dynamic', but it didn't work. The error disappeared after they deleted a specific record manually. The error may have been caused by malformed permissions. The user was also unable to view the record in the Appwrite console. The suggested solution is to use the debugger to inspect the data being returned by Appwrite.
Drake
15 Sep, 2023, 01:29

I wonder if you have malformed permissions. Maybe you can use the debugger to inspect what data is being returned by Appwrite

Said H
15 Sep, 2023, 01:31

Thanks Steven. I will try debugger. Btw, I was not able to view the record in Appwrite console too. It just loads infinitely. Other collections' records are fine

Drake
15 Sep, 2023, 01:32

Ya sounds like malformed document permissions...

Said H
15 Sep, 2023, 01:33

ok, i deleted that record and retry

Drake
15 Sep, 2023, 01:34

How are you creating the record? What's your code?

Said H
15 Sep, 2023, 01:34

manual entry

Said H
15 Sep, 2023, 01:34

I was just testing, so I manually input the record from appwrite console

Drake
15 Sep, 2023, 01:35

Weird...you shouldn't have malformed permissions doing that 🧐 I'm curious what the document json was...

Said H
15 Sep, 2023, 01:35

hmm...i couldn't click the record to view it though. Let me try to replicate πŸ™‚

Said H
15 Sep, 2023, 01:36

Hey Steven, the error disappeared after I deleted that record!

Said H
15 Sep, 2023, 01:36

Thanks for that. In the meantime, I will try to manually insert the doc again to see whether I can replicate the same problem

Said H
15 Sep, 2023, 01:40

Ok, I replicated the problem. Even though I created the record manually, I have a function that triggers on Create. That triggers assign permission to the record. And it assigned a same permission to the same person 2x. Thanks to you that i can zoom into the permission part.

Said H
15 Sep, 2023, 01:41

[SOLVED] Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'List<dynamic>'

Drake
15 Sep, 2023, 01:41

I'm pretty sure we've fixed this and cloud is pending an upgrade with the fix

Said H
15 Sep, 2023, 01:41

I see. Thank so much Steven

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