verify repo

This commit is contained in:
efrilm
2025-09-18 06:38:50 +07:00
parent 13c55afe3c
commit c40f96fc88
16 changed files with 1547 additions and 1 deletions
@@ -0,0 +1,58 @@
import 'package:bloc/bloc.dart';
import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../../domain/auth/auth.dart';
part 'verify_form_event.dart';
part 'verify_form_state.dart';
part 'verify_form_bloc.freezed.dart';
@injectable
class VerifyFormBloc extends Bloc<VerifyFormEvent, VerifyFormState> {
final IAuthRepository _repository;
VerifyFormBloc(this._repository) : super(VerifyFormState.initial()) {
on<VerifyFormEvent>(_onVerifyFormEvent);
}
Future<void> _onVerifyFormEvent(
VerifyFormEvent event,
Emitter<VerifyFormState> emit,
) {
return event.map(
registrationTokenChanged: (e) async {
emit(
state.copyWith(
registrationToken: e.registrationToken,
failureOrVerifyOption: none(),
),
);
},
otpCodeChanged: (e) async {
emit(state.copyWith(otpCode: e.otpCode, failureOrVerifyOption: none()));
},
submitted: (e) async {
Either<AuthFailure, Verify>? failureOrVerify;
emit(state.copyWith(isSubmitting: true, failureOrVerifyOption: none()));
final otpCodeValid = state.otpCode.isNotEmpty;
final registrationTokenValid = state.registrationToken.isNotEmpty;
if (registrationTokenValid && otpCodeValid) {
failureOrVerify = await _repository.verify(
registrationToken: state.registrationToken,
otpCode: state.otpCode,
);
emit(
state.copyWith(
isSubmitting: false,
failureOrVerifyOption: optionOf(failureOrVerify),
),
);
}
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
},
);
}
}
@@ -0,0 +1,750 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'verify_form_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$VerifyFormEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String registrationToken)
registrationTokenChanged,
required TResult Function(String otpCode) otpCodeChanged,
required TResult Function() submitted,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String registrationToken)? registrationTokenChanged,
TResult? Function(String otpCode)? otpCodeChanged,
TResult? Function()? submitted,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String registrationToken)? registrationTokenChanged,
TResult Function(String otpCode)? otpCodeChanged,
TResult Function()? submitted,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_RegistrationTokenChanged value)
registrationTokenChanged,
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
required TResult Function(_Submitted value) submitted,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_RegistrationTokenChanged value)?
registrationTokenChanged,
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
TResult? Function(_Submitted value)? submitted,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
TResult Function(_Submitted value)? submitted,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $VerifyFormEventCopyWith<$Res> {
factory $VerifyFormEventCopyWith(
VerifyFormEvent value,
$Res Function(VerifyFormEvent) then,
) = _$VerifyFormEventCopyWithImpl<$Res, VerifyFormEvent>;
}
/// @nodoc
class _$VerifyFormEventCopyWithImpl<$Res, $Val extends VerifyFormEvent>
implements $VerifyFormEventCopyWith<$Res> {
_$VerifyFormEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
abstract class _$$RegistrationTokenChangedImplCopyWith<$Res> {
factory _$$RegistrationTokenChangedImplCopyWith(
_$RegistrationTokenChangedImpl value,
$Res Function(_$RegistrationTokenChangedImpl) then,
) = __$$RegistrationTokenChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({String registrationToken});
}
/// @nodoc
class __$$RegistrationTokenChangedImplCopyWithImpl<$Res>
extends _$VerifyFormEventCopyWithImpl<$Res, _$RegistrationTokenChangedImpl>
implements _$$RegistrationTokenChangedImplCopyWith<$Res> {
__$$RegistrationTokenChangedImplCopyWithImpl(
_$RegistrationTokenChangedImpl _value,
$Res Function(_$RegistrationTokenChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? registrationToken = null}) {
return _then(
_$RegistrationTokenChangedImpl(
null == registrationToken
? _value.registrationToken
: registrationToken // ignore: cast_nullable_to_non_nullable
as String,
),
);
}
}
/// @nodoc
class _$RegistrationTokenChangedImpl implements _RegistrationTokenChanged {
const _$RegistrationTokenChangedImpl(this.registrationToken);
@override
final String registrationToken;
@override
String toString() {
return 'VerifyFormEvent.registrationTokenChanged(registrationToken: $registrationToken)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$RegistrationTokenChangedImpl &&
(identical(other.registrationToken, registrationToken) ||
other.registrationToken == registrationToken));
}
@override
int get hashCode => Object.hash(runtimeType, registrationToken);
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
get copyWith =>
__$$RegistrationTokenChangedImplCopyWithImpl<
_$RegistrationTokenChangedImpl
>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String registrationToken)
registrationTokenChanged,
required TResult Function(String otpCode) otpCodeChanged,
required TResult Function() submitted,
}) {
return registrationTokenChanged(registrationToken);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String registrationToken)? registrationTokenChanged,
TResult? Function(String otpCode)? otpCodeChanged,
TResult? Function()? submitted,
}) {
return registrationTokenChanged?.call(registrationToken);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String registrationToken)? registrationTokenChanged,
TResult Function(String otpCode)? otpCodeChanged,
TResult Function()? submitted,
required TResult orElse(),
}) {
if (registrationTokenChanged != null) {
return registrationTokenChanged(registrationToken);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_RegistrationTokenChanged value)
registrationTokenChanged,
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
required TResult Function(_Submitted value) submitted,
}) {
return registrationTokenChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_RegistrationTokenChanged value)?
registrationTokenChanged,
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
TResult? Function(_Submitted value)? submitted,
}) {
return registrationTokenChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
TResult Function(_Submitted value)? submitted,
required TResult orElse(),
}) {
if (registrationTokenChanged != null) {
return registrationTokenChanged(this);
}
return orElse();
}
}
abstract class _RegistrationTokenChanged implements VerifyFormEvent {
const factory _RegistrationTokenChanged(final String registrationToken) =
_$RegistrationTokenChangedImpl;
String get registrationToken;
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$OtpCodeChangedImplCopyWith<$Res> {
factory _$$OtpCodeChangedImplCopyWith(
_$OtpCodeChangedImpl value,
$Res Function(_$OtpCodeChangedImpl) then,
) = __$$OtpCodeChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({String otpCode});
}
/// @nodoc
class __$$OtpCodeChangedImplCopyWithImpl<$Res>
extends _$VerifyFormEventCopyWithImpl<$Res, _$OtpCodeChangedImpl>
implements _$$OtpCodeChangedImplCopyWith<$Res> {
__$$OtpCodeChangedImplCopyWithImpl(
_$OtpCodeChangedImpl _value,
$Res Function(_$OtpCodeChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? otpCode = null}) {
return _then(
_$OtpCodeChangedImpl(
null == otpCode
? _value.otpCode
: otpCode // ignore: cast_nullable_to_non_nullable
as String,
),
);
}
}
/// @nodoc
class _$OtpCodeChangedImpl implements _OtpCodeChanged {
const _$OtpCodeChangedImpl(this.otpCode);
@override
final String otpCode;
@override
String toString() {
return 'VerifyFormEvent.otpCodeChanged(otpCode: $otpCode)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OtpCodeChangedImpl &&
(identical(other.otpCode, otpCode) || other.otpCode == otpCode));
}
@override
int get hashCode => Object.hash(runtimeType, otpCode);
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OtpCodeChangedImplCopyWith<_$OtpCodeChangedImpl> get copyWith =>
__$$OtpCodeChangedImplCopyWithImpl<_$OtpCodeChangedImpl>(
this,
_$identity,
);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String registrationToken)
registrationTokenChanged,
required TResult Function(String otpCode) otpCodeChanged,
required TResult Function() submitted,
}) {
return otpCodeChanged(otpCode);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String registrationToken)? registrationTokenChanged,
TResult? Function(String otpCode)? otpCodeChanged,
TResult? Function()? submitted,
}) {
return otpCodeChanged?.call(otpCode);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String registrationToken)? registrationTokenChanged,
TResult Function(String otpCode)? otpCodeChanged,
TResult Function()? submitted,
required TResult orElse(),
}) {
if (otpCodeChanged != null) {
return otpCodeChanged(otpCode);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_RegistrationTokenChanged value)
registrationTokenChanged,
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
required TResult Function(_Submitted value) submitted,
}) {
return otpCodeChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_RegistrationTokenChanged value)?
registrationTokenChanged,
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
TResult? Function(_Submitted value)? submitted,
}) {
return otpCodeChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
TResult Function(_Submitted value)? submitted,
required TResult orElse(),
}) {
if (otpCodeChanged != null) {
return otpCodeChanged(this);
}
return orElse();
}
}
abstract class _OtpCodeChanged implements VerifyFormEvent {
const factory _OtpCodeChanged(final String otpCode) = _$OtpCodeChangedImpl;
String get otpCode;
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OtpCodeChangedImplCopyWith<_$OtpCodeChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$SubmittedImplCopyWith<$Res> {
factory _$$SubmittedImplCopyWith(
_$SubmittedImpl value,
$Res Function(_$SubmittedImpl) then,
) = __$$SubmittedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$SubmittedImplCopyWithImpl<$Res>
extends _$VerifyFormEventCopyWithImpl<$Res, _$SubmittedImpl>
implements _$$SubmittedImplCopyWith<$Res> {
__$$SubmittedImplCopyWithImpl(
_$SubmittedImpl _value,
$Res Function(_$SubmittedImpl) _then,
) : super(_value, _then);
/// Create a copy of VerifyFormEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
class _$SubmittedImpl implements _Submitted {
const _$SubmittedImpl();
@override
String toString() {
return 'VerifyFormEvent.submitted()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String registrationToken)
registrationTokenChanged,
required TResult Function(String otpCode) otpCodeChanged,
required TResult Function() submitted,
}) {
return submitted();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String registrationToken)? registrationTokenChanged,
TResult? Function(String otpCode)? otpCodeChanged,
TResult? Function()? submitted,
}) {
return submitted?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String registrationToken)? registrationTokenChanged,
TResult Function(String otpCode)? otpCodeChanged,
TResult Function()? submitted,
required TResult orElse(),
}) {
if (submitted != null) {
return submitted();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_RegistrationTokenChanged value)
registrationTokenChanged,
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
required TResult Function(_Submitted value) submitted,
}) {
return submitted(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_RegistrationTokenChanged value)?
registrationTokenChanged,
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
TResult? Function(_Submitted value)? submitted,
}) {
return submitted?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
TResult Function(_Submitted value)? submitted,
required TResult orElse(),
}) {
if (submitted != null) {
return submitted(this);
}
return orElse();
}
}
abstract class _Submitted implements VerifyFormEvent {
const factory _Submitted() = _$SubmittedImpl;
}
/// @nodoc
mixin _$VerifyFormState {
String get registrationToken => throw _privateConstructorUsedError;
String get otpCode => throw _privateConstructorUsedError;
Option<Either<AuthFailure, Verify>> get failureOrVerifyOption =>
throw _privateConstructorUsedError;
bool get isSubmitting => throw _privateConstructorUsedError;
bool get showErrorMessages => throw _privateConstructorUsedError;
/// Create a copy of VerifyFormState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$VerifyFormStateCopyWith<VerifyFormState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $VerifyFormStateCopyWith<$Res> {
factory $VerifyFormStateCopyWith(
VerifyFormState value,
$Res Function(VerifyFormState) then,
) = _$VerifyFormStateCopyWithImpl<$Res, VerifyFormState>;
@useResult
$Res call({
String registrationToken,
String otpCode,
Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
bool isSubmitting,
bool showErrorMessages,
});
}
/// @nodoc
class _$VerifyFormStateCopyWithImpl<$Res, $Val extends VerifyFormState>
implements $VerifyFormStateCopyWith<$Res> {
_$VerifyFormStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of VerifyFormState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? registrationToken = null,
Object? otpCode = null,
Object? failureOrVerifyOption = null,
Object? isSubmitting = null,
Object? showErrorMessages = null,
}) {
return _then(
_value.copyWith(
registrationToken: null == registrationToken
? _value.registrationToken
: registrationToken // ignore: cast_nullable_to_non_nullable
as String,
otpCode: null == otpCode
? _value.otpCode
: otpCode // ignore: cast_nullable_to_non_nullable
as String,
failureOrVerifyOption: null == failureOrVerifyOption
? _value.failureOrVerifyOption
: failureOrVerifyOption // ignore: cast_nullable_to_non_nullable
as Option<Either<AuthFailure, Verify>>,
isSubmitting: null == isSubmitting
? _value.isSubmitting
: isSubmitting // ignore: cast_nullable_to_non_nullable
as bool,
showErrorMessages: null == showErrorMessages
? _value.showErrorMessages
: showErrorMessages // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$VerifyFormStateImplCopyWith<$Res>
implements $VerifyFormStateCopyWith<$Res> {
factory _$$VerifyFormStateImplCopyWith(
_$VerifyFormStateImpl value,
$Res Function(_$VerifyFormStateImpl) then,
) = __$$VerifyFormStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String registrationToken,
String otpCode,
Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
bool isSubmitting,
bool showErrorMessages,
});
}
/// @nodoc
class __$$VerifyFormStateImplCopyWithImpl<$Res>
extends _$VerifyFormStateCopyWithImpl<$Res, _$VerifyFormStateImpl>
implements _$$VerifyFormStateImplCopyWith<$Res> {
__$$VerifyFormStateImplCopyWithImpl(
_$VerifyFormStateImpl _value,
$Res Function(_$VerifyFormStateImpl) _then,
) : super(_value, _then);
/// Create a copy of VerifyFormState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? registrationToken = null,
Object? otpCode = null,
Object? failureOrVerifyOption = null,
Object? isSubmitting = null,
Object? showErrorMessages = null,
}) {
return _then(
_$VerifyFormStateImpl(
registrationToken: null == registrationToken
? _value.registrationToken
: registrationToken // ignore: cast_nullable_to_non_nullable
as String,
otpCode: null == otpCode
? _value.otpCode
: otpCode // ignore: cast_nullable_to_non_nullable
as String,
failureOrVerifyOption: null == failureOrVerifyOption
? _value.failureOrVerifyOption
: failureOrVerifyOption // ignore: cast_nullable_to_non_nullable
as Option<Either<AuthFailure, Verify>>,
isSubmitting: null == isSubmitting
? _value.isSubmitting
: isSubmitting // ignore: cast_nullable_to_non_nullable
as bool,
showErrorMessages: null == showErrorMessages
? _value.showErrorMessages
: showErrorMessages // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// @nodoc
class _$VerifyFormStateImpl implements _VerifyFormState {
const _$VerifyFormStateImpl({
required this.registrationToken,
required this.otpCode,
required this.failureOrVerifyOption,
this.isSubmitting = false,
this.showErrorMessages = false,
});
@override
final String registrationToken;
@override
final String otpCode;
@override
final Option<Either<AuthFailure, Verify>> failureOrVerifyOption;
@override
@JsonKey()
final bool isSubmitting;
@override
@JsonKey()
final bool showErrorMessages;
@override
String toString() {
return 'VerifyFormState(registrationToken: $registrationToken, otpCode: $otpCode, failureOrVerifyOption: $failureOrVerifyOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$VerifyFormStateImpl &&
(identical(other.registrationToken, registrationToken) ||
other.registrationToken == registrationToken) &&
(identical(other.otpCode, otpCode) || other.otpCode == otpCode) &&
(identical(other.failureOrVerifyOption, failureOrVerifyOption) ||
other.failureOrVerifyOption == failureOrVerifyOption) &&
(identical(other.isSubmitting, isSubmitting) ||
other.isSubmitting == isSubmitting) &&
(identical(other.showErrorMessages, showErrorMessages) ||
other.showErrorMessages == showErrorMessages));
}
@override
int get hashCode => Object.hash(
runtimeType,
registrationToken,
otpCode,
failureOrVerifyOption,
isSubmitting,
showErrorMessages,
);
/// Create a copy of VerifyFormState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$VerifyFormStateImplCopyWith<_$VerifyFormStateImpl> get copyWith =>
__$$VerifyFormStateImplCopyWithImpl<_$VerifyFormStateImpl>(
this,
_$identity,
);
}
abstract class _VerifyFormState implements VerifyFormState {
const factory _VerifyFormState({
required final String registrationToken,
required final String otpCode,
required final Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
final bool isSubmitting,
final bool showErrorMessages,
}) = _$VerifyFormStateImpl;
@override
String get registrationToken;
@override
String get otpCode;
@override
Option<Either<AuthFailure, Verify>> get failureOrVerifyOption;
@override
bool get isSubmitting;
@override
bool get showErrorMessages;
/// Create a copy of VerifyFormState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$VerifyFormStateImplCopyWith<_$VerifyFormStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -0,0 +1,11 @@
part of 'verify_form_bloc.dart';
@freezed
class VerifyFormEvent with _$VerifyFormEvent {
const factory VerifyFormEvent.registrationTokenChanged(
String registrationToken,
) = _RegistrationTokenChanged;
const factory VerifyFormEvent.otpCodeChanged(String otpCode) =
_OtpCodeChanged;
const factory VerifyFormEvent.submitted() = _Submitted;
}
@@ -0,0 +1,18 @@
part of 'verify_form_bloc.dart';
@freezed
class VerifyFormState with _$VerifyFormState {
const factory VerifyFormState({
required String registrationToken,
required String otpCode,
required Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
@Default(false) bool isSubmitting,
@Default(false) bool showErrorMessages,
}) = _VerifyFormState;
factory VerifyFormState.initial() => VerifyFormState(
registrationToken: '',
otpCode: '',
failureOrVerifyOption: none(),
);
}