Closed InAnadea closed 1 week ago
I did a temporary work around but had to make them all optional.
sed -i 's/num.parse/num.tryParse/g' lib/model/*.dart
To follow up on this, it is not a bug in the dart code generator. The server code just needs to add the nullable option and not just the not required option. The code generator then does this:
numProperty: json[r'numProperty'] == null
? null
: num.parse('${json[r'numProperty']}'),
This particular server side is using the Java annotations:
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true)
private BigDecimal numProperty;
Closing this as its a server issue. Dont hessitate to reopen if you disagree
Description of the bug
Nullable
num
fields can't be parsed usingparse
constructor. It should usetryParse
.Steps to reproduce
Expected behavior
num?
values should be parsed usingtryParse
Logs
No response
Screenshots
No response
Platform
macOS
Library version
^5.0.2
Flutter version
3.19.2
Flutter channel
stable
Additional context
No response