๐ Bug Report: createFloatAttribute() 'toDouble' was called on null.
stonith404 opened this issue ยท 3 comments
stonith404 commented
๐ Reproduction steps
Execute the following function:
database.createFloatAttribute(
collectionId: "collection",
key: "someKey",
xrequired: true)
๐ Expected behavior
The function should be executed without an error.
๐ Actual Behavior
The function returns:
NoSuchMethodError: The method 'toDouble' was called on null.
Receiver: null
Tried calling: toDouble()
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:68:5)
#1 new AttributeFloat.fromMap (package:dart_appwrite/src/models/attribute_float.dart:49:32)
#2 Database.createFloatAttribute (package:dart_appwrite/services/database.dart:279:34)
<asynchronous suspension>
As I can see the method toDouble
is called on parameter that is not required. The problem is the min
,max
or xdefault
parameter.
๐ฒ Appwrite version
Different version (specify in environment)
๐ป Operating system
Linux
๐งฑ Your Environment
V0.12
๐ Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
๐ข Have you read the Code of Conduct?
- I have read the Code of Conduct
stonith404 commented
@wess Moved.
sbergmair commented
Can confirm this behaviour
factory AttributeFloat.fromMap(Map<String, dynamic> map) {
return AttributeFloat(
key: map['key'].toString(),
type: map['type'].toString(),
status: map['status'].toString(),
xrequired: map['required'],
array: map['array'],
min: map['min'].toDouble(),
max: map['max'].toDouble(),
xdefault: map['default'].toDouble(),
);
}
xdefault isn't required, therefore it can be null
lohanidamodar commented
Should be fixed on dart_appwrite: 4.0.2