-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Hello,
I have the next union:
"unions": {
"myValue": {
"types": [
{
"type": "integer",
"description": "Simple integer value."
},
{
"type": "double",
"description": "Simple double value."
},
{
"type": "someCustomValue",
"description": "A custom value."
},
{
"type": "someCustomValue2",
"description": "A custom value."
}
]
}
}And while compiling I get the next error:
Error: The operator '[]' isn't defined for the class 'int'.
[ +6 ms] Try correcting the operator to an existing operator, or defining a '[]' operator.
[ ] factory.first((json['integer'] as int)['value']));
A part of the generated code (dart):
switch (discriminator) {
case 'integer':
return blaBlaMyValue._(
factory.first((json['integer'] as int)['value']));
case 'double':
return blaBlaMyValue._(
factory.second((json['double'] as double)['value']));
case 'pressureObservationValue':When I manually remove ['value'] compilation is successful.
What am I doing wrong? Thanks.
Metadata
Metadata
Assignees
Labels
No labels