Back

Getting error on accessing $ prefixed fields while using Dart for Appwrite.

  • 0
  • Flutter
  • Functions
  • Cloud
james54
30 Sep, 2023, 13:36

I am using dart 2.17 for creating appwrite function,

Usecase:

  • Trying to create use document on every user creation.

Error:

  • When i try to access '$id' field of user from event data i am getting error shown in screenshot.
  • Interesting thing is when i log the same id with context.log it is working fine

If you guys can suggest how should i write functions with dart so that i can use inbuild models like user and others ,if possible please share similar kind of working function.

TL;DR
The user is getting an error when trying to access $ prefixed fields while using Dart for Appwrite. They are trying to create a document on every user creation. They found a mistake in their code where they called $id directly on the user object. The suggested solution is to remove `.toString()` from the code.
james54
30 Sep, 2023, 13:37

Getting error on accessing $ prefixed fields while using Dart for Appwrite.

safwan
30 Sep, 2023, 13:41

Can you try to remove the .toString(), and see if it works?

Super weird that it works with context.log and not when assigning

james54
30 Sep, 2023, 13:43

Holy s*** ,while reading the code i found that i have called $id directly on user object

safwan
30 Sep, 2023, 13:45

In the permissions object?

james54
30 Sep, 2023, 13:49

Yes and after changing that it is working

safwan
30 Sep, 2023, 13:49

Ah okay

safwan
30 Sep, 2023, 13:49

Yeah i’ve been in similar situations and it’s such a shocker realizing the silly mistake 😩😜

james54
30 Sep, 2023, 13:50

Thanks for response i m closing this silly issue

safwan
30 Sep, 2023, 13:50

hahaha no worries 😁😁

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