ExtensionType.fromValue constructor

ExtensionType.fromValue(
  1. int v
)

Creates an ExtensionType instance from the provided value.

Throws a MessageException if no ExtensionType is found for the given value.

Implementation

factory ExtensionType.fromValue(int v) {
  try {
    return values.firstWhere((element) => element.value == v);
  } on StateError {
    throw MessageException("No ExtensionType found for the given value.",
        details: {"value": v});
  }
}