fromCode static method

OsmosErrorCodes? fromCode(
  1. String? code
)

Find Error by error code string

Implementation

static OsmosErrorCodes? fromCode(String? code) {
  if (code == null) return null;
  try {
    return OsmosErrorCodes.values.firstWhere((e) => e.code == code);
  } catch (e) {
    return null;
  }
}