tryValueOf<V> method

V? tryValueOf<V>(
  1. String fieldName
)

Reads another field value from the same visual row when it is assignable to V.

Returns null when the field value is null or when the runtime value is not assignable to V. This is useful for optional custom-cell lookups where mismatched data should not throw during build.

Implementation

V? tryValueOf<V>(String fieldName) {
  if (!_fieldExists(fieldName)) {
    return null;
  }
  final value = _fieldValueResolver(fieldName);
  if (value == null || value is V) {
    return value as V?;
  }
  return null;
}