
AppwriteException: general_argument_invalid, Param "default" is not optional. (400)
TL;DR
Error occurs when attempting to update a string attribute's default value in Dart SDK due to the value being required, not allowing it to be set to null. To solve this, the `xdefault` parameter should be handled differently when `attributeA.required` is true to avoid setting it to null, which results in an error.
cc: @D5 We are using dart-sdk for performing this sync

Here is a code snippet for the same:
TypeScript
await dest.databases.updateStringAttribute(
databaseId: databaseId,
collectionId: collectionId,
key: attributeA.key,
size: attributeA.size!,
xrequired: attributeA.required,
xdefault:
attributeA.required ? null : (attributeA.defaultValue ?? ''),
);

if I write the xdefault
part like this:
TypeScript
xdefault: attributeA.defaultValue ?? '',
I get this error:
AppwriteException: attribute_default_unsupported, Cannot set default value for required attribute (400)

Hmm I think it can't be nul as it needs to be true or false?
Recommended threads
- Query params are way too limiting in ter...
I was trying to list rows in a table that do not already exist in another table. I retrieved around 260 row IDs which are 13 characters in length each, and then...
- [Node.js SDK] Bypass 2GB file limit?
Hello. Using either InputFile.fromPath or InputFile.fromBuffer throws this error: File size (2295467305) is greater than 2 GiB Bucket limit etc. is setup corre...
- What Happens When You Add a Custom Domai...
