fromString static method

KindeErrorCode fromString(
  1. String code
)

Find error code by its string value.

Returns the corresponding KindeErrorCode enum value for the given string code. If no match is found, returns KindeErrorCode.unknown.

This enables backward compatibility with code that uses string-based error codes.

Example:

final code = KindeErrorCode.fromString('user-canceled');
assert(code == KindeErrorCode.userCanceled);

Implementation

static KindeErrorCode fromString(String code) {
  return values.firstWhere(
    (e) => e.code == code,
    orElse: () => KindeErrorCode.unknown,
  );
}