Back

[SOLVED] Appwrite Query.select throw error no matter what attributes are given as parameter(s)

  • 0
  • Databases
  • Flutter
paritodev
31 Mar, 2024, 23:08

When I add a Query.select in my queries, I systematically have this error, independently of what attribute(s) is/are given as parameter(s).

type 'Null' is not a subtype of type 'List<dynamic>'#0 new Document,fromMap (package:appwrite/src/models/document.dart:41 :24)

Here is an example of a select query that throw the error:

Query.select(["title", "pubDate"]);

Both title and select are parameters that exist and are required on my document attributes.

Doing queries without select work, but as soon as I add a select query, I get this error. Doing a select query alone without any other queries also result in this error.

TL;DR
Developers were experiencing an error with Appwrite's Query.select no matter what attributes were given. The issue was solved by manually including system attributes in the query. To fix this problem, use version 11.0.1 and ensure that your flutter SDK version is correct.
Kenny
31 Mar, 2024, 23:29

You’re probably using the wrong version of the flutter SDK if you’re on cloud.

Kenny
31 Mar, 2024, 23:29

If you’re using the latest go back one

Kenny
31 Mar, 2024, 23:31

Use 11.0.1

paritodev
31 Mar, 2024, 23:43

I am already on 11.0.1 as the newer version had some issues. After looking on about this more, I actually found a single other thread discussing about it.

Somehow, we have to manually include these system attributes despite no documentation talking about it and having to do the guesswork:

final List<String> systemAttributes = [ "id", "createdAt", "updatedAt", "permissions", //"databaseId", //"collectionId", //"databaseId", //"collectionId", ];

Anyhow, it is solved now, thank you for your time.

paritodev
31 Mar, 2024, 23:43

[SOLVED Appwrite Query.select throw error no matter what attributes are given as parameter(s)

paritodev
31 Mar, 2024, 23:43

[SOLVED] Appwrite Query.select throw error no matter what attributes are given as parameter(s)

paritodev
31 Mar, 2024, 23:48

Also, as a side note, is there any purpose in not including those automatically in the request? The queries are handled by the appwrite SDK and the appwrite SDK cannot handle receiving a document that doesn't have these, so why would it not query these automatically each time?

It's such a weird design choice for me (especially since it isn't mentionned in the documentation and no example shows this too), can anyone in the team explain the why if there is any reason for this choice?

I would be another thing is somehow the user wrote a manual query7 for whatever reason.

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