byName static method

ModalPresentationStyle? byName(
  1. String? name
)

Gets a possible ModalPresentationStyle instance value with name name.

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

Implementation

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