tryGet<T> method

T? tryGet<T>(
  1. String field
)

Try to get the value of a field by name, returning null if:

  • the field does not exist
  • the field value is not of type T
  • any ArgumentError is thrown during retrieval

(see get)

Implementation

T? tryGet<T>(String field) {
  try {
    final value = get(field);
    return value is T ? value : null;
  } on ArgumentError {
    return null;
  }
}