byName static method

FontSubpixelLayout? byName(
  1. String? name
)

Gets a possible FontSubpixelLayout instance value with name name.

Goes through FontSubpixelLayout.values looking for a value with name name, as reported by FontSubpixelLayout.name. Returns the first value with the given name, otherwise null.

Implementation

static FontSubpixelLayout? byName(String? name) {
  if (name != null) {
    try {
      return FontSubpixelLayout.values.firstWhere(
        (element) => element.name() == name,
      );
    } catch (e) {
      return null;
    }
  }
  return null;
}