sdk-for-dart
sdk-for-dart copied to clipboard
🐛 Bug Report: Error updating properties of required attributes using dart-sdk
👟 Reproduction steps
- Create a new collection with a
stringattribute withrequired= true and give a max size of 255. - Try to update only the max size of this attribute using dart-sdk.
Sample code:
import 'package:dart_appwrite/dart_appwrite.dart';
import 'package:televolution_sync/appwrite/appwrite.dart';
void main() async {
final client = Client()
..setEndpoint(constants.endpoint)
..setProject(constants.projectId)
..setKey(constants.apiKey)
..setSelfSigned(status: true);
final databases = Databases(client);
final nameAttribute = await databases.getAttribute(
databaseId: 'TEST',
collectionId: 'TESTCOLLECTION',
key: 'name',
);
print('nameAttribute = $nameAttribute');
// Output of above line:
// nameAttribute = {key: name, type: string, status: available, error: , required: true, array: false, size: 255, default: null}
/// Now, I will try to update the size to 1000 (previously 255)
final updatedAttribute = await databases.updateStringAttribute(
databaseId: 'TEST',
collectionId: 'TESTCOLLECTION',
key: 'name',
size: 1000,
xdefault: null, // I also tried these values here: ("", "no name", null), but I get errors on all of them.
xrequired: true,
);
print('updatedAttribute = $updatedAttribute'); // Never reached this line
}
👍 Expected behavior
The attribute should be updated with the new size.
👎 Actual Behavior
Get an error related to default value:
-
If you try to keep
nullas the default value: -
If you try to give some other default value (which shouldn't be the case, because the attribute is required by nature):
🎲 Appwrite version
Different version (specify in environment)
💻 Operating system
Something else
🧱 Your Environment
Appwrite Cloud Version: 1.6.0
Dart Version: 3.1.5
Dart SDK Version: dart_appwrite 12.1.0
The code doesn't work, neither from my local machine nor from an appwrite function.
👀 Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [x] I have read the Code of Conduct