fromValue static method

ServiceErrorCode? fromValue(
  1. int value
)

Returns a ServiceErrorCode from its numeric value.

If no matching error code is found, returns ServiceErrorCode.internal.

value The numeric error code to convert.

Returns the corresponding ServiceErrorCode or internal if not found.

Implementation

static ServiceErrorCode? fromValue(int value) {
  return ServiceErrorCode.values.firstWhere(
    (e) => e.value == value,
    orElse: () => ServiceErrorCode.internal,
  );
}