40 lines
864 B
Dart
40 lines
864 B
Dart
enum VerificationStatus {
|
|
idle,
|
|
sending,
|
|
sent,
|
|
checking,
|
|
verified,
|
|
expired,
|
|
invalid,
|
|
error,
|
|
}
|
|
|
|
enum VerificationError { expired, invalid, internal, needsAssistance }
|
|
|
|
class VerificationException implements Exception {
|
|
const VerificationException(this.code);
|
|
final VerificationError code;
|
|
}
|
|
|
|
class VerificationResult {
|
|
const VerificationResult({required this.isSimulated, this.verifiedEmail});
|
|
final bool isSimulated;
|
|
final String? verifiedEmail;
|
|
}
|
|
|
|
class VerificationState {
|
|
const VerificationState(
|
|
this.status, {
|
|
this.isSimulated = false,
|
|
this.error,
|
|
this.result,
|
|
});
|
|
final VerificationStatus status;
|
|
final VerificationError? error;
|
|
final bool isSimulated;
|
|
final VerificationResult? result;
|
|
bool get isLoading =>
|
|
status == VerificationStatus.sending ||
|
|
status == VerificationStatus.checking;
|
|
}
|