tryParse static method

ArrayValue? tryParse(
  1. List value
)
override

Tries to instantiate a new ArrayValue from a raw value.

If parsing of at least one input element fails, null is returned instead.

Implementation

static ArrayValue? tryParse(List<dynamic> value) {
  final result = <Object?>[];

  for (final entry in value) {
    final arrayValue = DataSchemaValue.tryParse(entry);

    if (arrayValue == null) {
      return null;
    }

    result.add(entry);
  }

  return ArrayValue._fromValue(result);
}