tryParse static method
Tries to instantiate a new ObjectValue from a raw value
.
If parsing of at least one entry fails, null
is returned instead.
Implementation
static ObjectValue? tryParse(Map<Object?, Object?> value) {
final result = <String, Object?>{};
for (final entry in value.entries) {
final key = entry.key;
if (key is! String) {
continue;
}
final mapValue = DataSchemaValue.tryParse(entry.value);
if (mapValue == null) {
return null;
}
result[key] = entry.value;
}
return ObjectValue._fromValue(result);
}