google / google/built_value.dart
[Question] Returning or NOT Returning a nullable from deserializeWith ?
Open
question
- Dominant language
- Dart
- Stars
- 886
- Forks
- 195
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 4
Description
My code is implementing a fromJson method calling the **deserializeWith** method returning an optional.
- Is it safe for me to return a Beacon and not a Beacon? ?
- In which case a null will be returned from the **deserializeWith** method
Code would be simple to maintain if method is returning a non nullable value and throw exception when required
```
static Beacon? fromJson(String jsonString) {
return serializers.deserializeWith(
Beacon.serializer, json.decode(jsonString));
}
```
Contributor guide
Assessment
This issue has not been assessed yet.