getByValue static method

ErrorCodes? getByValue(
  1. int? i
)

Implementation

static ErrorCodes? getByValue(int? i) {
  if (i == null) return null;
  try {
    return ErrorCodes.values.firstWhere((x) => x.value == i);
  } catch (_) {
    return ErrorCodes.UNKNOWN;
  }
}