fromInt static method

ErrorCode fromInt(
  1. int code
)

Returns the ErrorCode corresponding to the given integer code.

Throws an ArgumentError if the code is invalid.

Implementation

static ErrorCode fromInt(int code) {
  return ErrorCode.values.firstWhere(
    (e) => e.code == code,
    orElse: () => throw ArgumentError('Invalid error code: $code'),
  );
}