getErrorCodesFromString function

ErrorCodes? getErrorCodesFromString(
  1. String value
)

Returns the error codes from value.

Implementation

ErrorCodes? getErrorCodesFromString(String value) {
  final errorCodes = ErrorCodes.values.where((e) =>
      e.toString() == value ||
      e.toString() == 'ErrorCodes.${value.toUpperCase()}');

  if (errorCodes.isNotEmpty) return errorCodes.first;
  return null;
}