Hey there, out of curiosity, what is the difference between passing ID.custom(id) to a document ID instead of a custom string variable? I mean, if I'm going to call this function and pass my custom ID to it, couldn't I just pass my custom ID directly? It doesn't make any sense to me
Yoy mean when creating document
Yes,
👍
And you mean ID.unique() Function?
No, just 'ID.custom(id)'
Can you share the code?
Why are you using the ID.custom
const String documentID = 'mycustomID';
await ApiConst.databases.createDocument(
databaseId: ApiConst.databaseID,
collectionId: collectionsIDs[type]!,
documentId: ID.custom(documentID),
permissions: permissions,
data: data,
);
const String documentID = 'mycustomID';
await ApiConst.databases.createDocument(
databaseId: ApiConst.databaseID,
collectionId: collectionsIDs[type]!,
documentId: documentID,
permissions: permissions,
data: data,
);
From you can see from the code it doesn't make any different and both ways will work the same
You can see here https://github.com/appwrite/sdk-for-flutter/blob/master/lib/id.dart#L10
Sometimes I need to assign the same ID to multiple documents stored in different collections (belonging to a particular user). This helps me retrieve these documents easily when needed without having to create any indexes
Okay,
You can just send any string as the id
Recommended threads
- Unknown column 'sourceSize' in 'field li...
After migrating from 1.6.1 to 1.7.4 I noticed this message in the logs: `appwrite-worker-stats-resources | 2025-10-26T10:32:38.289577112Z Failed: SQLSTATE[...
- Invalid document structure: Missing requ...
After migrating from 1.6.1 to 1.7.4 I noticed this message in the logs: appwrite-worker-audits | 2025-10-26T11:15:24.062537020Z Error processing a...
- Could not connect to SMTP server: SMTP E...
Hi there, I have currently an issue configuring my SMTP (Custom SMTP server) setting in appwrite. My Setup: - Self-hosted (DigitalOcean): appwrite 1.8.0 - SM...