google / google/built_value.dart
`JsonObject` factory accepts null, but will throw when null is passed
- Dominant language
- Dart
- Stars
- 886
- Forks
- 195
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 4
Description
the `JsonObject` factory accepts a nullable parameter, but if null is passed it will throw
```dart
/// Instantiates with [value], which must be a bool, a List, a Map, a num
/// or a String. Otherwise, an [ArgumentError] is thrown.
factory JsonObject(Object? value) {
if (value is num) {
return NumJsonObject(value);
} else if (value is String) {
return StringJsonObject(value);
} else if (value is bool) {
return BoolJsonObject(value);
} else if (value is List) {
return ListJsonObject(value);
} else if (value is Map) {
return MapJsonObject(value);
} else if (value is Map) {
// Allow wrong type map, check individual values.
return MapJsonObject(value.cast());
} else {
throw ArgumentError.value(value, 'value',
'Must be bool, List, Map, num or String');
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.