fieldByTypeName method

Field? fieldByTypeName(
  1. String name
)

Returns a field given its local or common type name. Returns null if not found.

Implementation

Field? fieldByTypeName(String name) {
  Field? field =
      fields.firstWhereOrNull((element) => element.type.name == name);

  if (field != null) {
    return field;
  }

  return fields
      .firstWhereOrNull((element) => element.type.commonType?.name == name);
}