Compare commits
4 Commits
c072e4c168
...
13c55afe3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13c55afe3c | ||
|
|
99bf4d5c7f | ||
|
|
207dda29df | ||
|
|
c3263edb89 |
@ -0,0 +1,56 @@
|
|||||||
|
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 'check_phone_form_event.dart';
|
||||||
|
part 'check_phone_form_state.dart';
|
||||||
|
part 'check_phone_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class CheckPhoneFormBloc
|
||||||
|
extends Bloc<CheckPhoneFormEvent, CheckPhoneFormState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
CheckPhoneFormBloc(this._repository) : super(CheckPhoneFormState.initial()) {
|
||||||
|
on<CheckPhoneFormEvent>(_onCheckPhoneFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onCheckPhoneFormEvent(
|
||||||
|
CheckPhoneFormEvent event,
|
||||||
|
Emitter<CheckPhoneFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
phoneNumberChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
phoneNumber: e.phoneNumber,
|
||||||
|
failureOrCheckPhoneOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
submitted: (e) async {
|
||||||
|
Either<AuthFailure, CheckPhone>? failureOrCheckPhone;
|
||||||
|
emit(
|
||||||
|
state.copyWith(isSubmitting: true, failureOrCheckPhoneOption: none()),
|
||||||
|
);
|
||||||
|
|
||||||
|
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||||
|
|
||||||
|
if (phoneNumberValid) {
|
||||||
|
failureOrCheckPhone = await _repository.checkPhone(
|
||||||
|
phoneNumber: state.phoneNumber,
|
||||||
|
);
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrCheckPhoneOption: optionOf(failureOrCheckPhone),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,552 @@
|
|||||||
|
// 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 'check_phone_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 _$CheckPhoneFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CheckPhoneFormEventCopyWith<$Res> {
|
||||||
|
factory $CheckPhoneFormEventCopyWith(
|
||||||
|
CheckPhoneFormEvent value,
|
||||||
|
$Res Function(CheckPhoneFormEvent) then,
|
||||||
|
) = _$CheckPhoneFormEventCopyWithImpl<$Res, CheckPhoneFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CheckPhoneFormEventCopyWithImpl<$Res, $Val extends CheckPhoneFormEvent>
|
||||||
|
implements $CheckPhoneFormEventCopyWith<$Res> {
|
||||||
|
_$CheckPhoneFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$PhoneNumberChangedImplCopyWith(
|
||||||
|
_$PhoneNumberChangedImpl value,
|
||||||
|
$Res Function(_$PhoneNumberChangedImpl) then,
|
||||||
|
) = __$$PhoneNumberChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String phoneNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$PhoneNumberChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckPhoneFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||||
|
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||||
|
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||||
|
_$PhoneNumberChangedImpl _value,
|
||||||
|
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? phoneNumber = null}) {
|
||||||
|
return _then(
|
||||||
|
_$PhoneNumberChangedImpl(
|
||||||
|
null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$PhoneNumberChangedImpl implements _PhoneNumberChanged {
|
||||||
|
const _$PhoneNumberChangedImpl(this.phoneNumber);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckPhoneFormEvent.phoneNumberChanged(phoneNumber: $phoneNumber)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$PhoneNumberChangedImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||||
|
__$$PhoneNumberChangedImplCopyWithImpl<_$PhoneNumberChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (phoneNumberChanged != null) {
|
||||||
|
return phoneNumberChanged(phoneNumber);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (phoneNumberChanged != null) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PhoneNumberChanged implements CheckPhoneFormEvent {
|
||||||
|
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||||
|
_$PhoneNumberChangedImpl;
|
||||||
|
|
||||||
|
String get phoneNumber;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckPhoneFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckPhoneFormEvent.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 phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements CheckPhoneFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CheckPhoneFormState {
|
||||||
|
String get phoneNumber => throw _privateConstructorUsedError;
|
||||||
|
Option<Either<AuthFailure, CheckPhone>> get failureOrCheckPhoneOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CheckPhoneFormStateCopyWith<CheckPhoneFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CheckPhoneFormStateCopyWith<$Res> {
|
||||||
|
factory $CheckPhoneFormStateCopyWith(
|
||||||
|
CheckPhoneFormState value,
|
||||||
|
$Res Function(CheckPhoneFormState) then,
|
||||||
|
) = _$CheckPhoneFormStateCopyWithImpl<$Res, CheckPhoneFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CheckPhoneFormStateCopyWithImpl<$Res, $Val extends CheckPhoneFormState>
|
||||||
|
implements $CheckPhoneFormStateCopyWith<$Res> {
|
||||||
|
_$CheckPhoneFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? failureOrCheckPhoneOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrCheckPhoneOption: null == failureOrCheckPhoneOption
|
||||||
|
? _value.failureOrCheckPhoneOption
|
||||||
|
: failureOrCheckPhoneOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, CheckPhone>>,
|
||||||
|
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 _$$CheckPhoneFormStateImplCopyWith<$Res>
|
||||||
|
implements $CheckPhoneFormStateCopyWith<$Res> {
|
||||||
|
factory _$$CheckPhoneFormStateImplCopyWith(
|
||||||
|
_$CheckPhoneFormStateImpl value,
|
||||||
|
$Res Function(_$CheckPhoneFormStateImpl) then,
|
||||||
|
) = __$$CheckPhoneFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CheckPhoneFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckPhoneFormStateCopyWithImpl<$Res, _$CheckPhoneFormStateImpl>
|
||||||
|
implements _$$CheckPhoneFormStateImplCopyWith<$Res> {
|
||||||
|
__$$CheckPhoneFormStateImplCopyWithImpl(
|
||||||
|
_$CheckPhoneFormStateImpl _value,
|
||||||
|
$Res Function(_$CheckPhoneFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? failureOrCheckPhoneOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$CheckPhoneFormStateImpl(
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrCheckPhoneOption: null == failureOrCheckPhoneOption
|
||||||
|
? _value.failureOrCheckPhoneOption
|
||||||
|
: failureOrCheckPhoneOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, CheckPhone>>,
|
||||||
|
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 _$CheckPhoneFormStateImpl implements _CheckPhoneFormState {
|
||||||
|
const _$CheckPhoneFormStateImpl({
|
||||||
|
required this.phoneNumber,
|
||||||
|
required this.failureOrCheckPhoneOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
this.showErrorMessages = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool showErrorMessages;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckPhoneFormState(phoneNumber: $phoneNumber, failureOrCheckPhoneOption: $failureOrCheckPhoneOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CheckPhoneFormStateImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber) &&
|
||||||
|
(identical(
|
||||||
|
other.failureOrCheckPhoneOption,
|
||||||
|
failureOrCheckPhoneOption,
|
||||||
|
) ||
|
||||||
|
other.failureOrCheckPhoneOption == failureOrCheckPhoneOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting) &&
|
||||||
|
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||||
|
other.showErrorMessages == showErrorMessages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
phoneNumber,
|
||||||
|
failureOrCheckPhoneOption,
|
||||||
|
isSubmitting,
|
||||||
|
showErrorMessages,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CheckPhoneFormStateImplCopyWith<_$CheckPhoneFormStateImpl> get copyWith =>
|
||||||
|
__$$CheckPhoneFormStateImplCopyWithImpl<_$CheckPhoneFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CheckPhoneFormState implements CheckPhoneFormState {
|
||||||
|
const factory _CheckPhoneFormState({
|
||||||
|
required final String phoneNumber,
|
||||||
|
required final Option<Either<AuthFailure, CheckPhone>>
|
||||||
|
failureOrCheckPhoneOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
final bool showErrorMessages,
|
||||||
|
}) = _$CheckPhoneFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get phoneNumber;
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, CheckPhone>> get failureOrCheckPhoneOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
@override
|
||||||
|
bool get showErrorMessages;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CheckPhoneFormStateImplCopyWith<_$CheckPhoneFormStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
part of 'check_phone_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CheckPhoneFormEvent with _$CheckPhoneFormEvent {
|
||||||
|
const factory CheckPhoneFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||||
|
_PhoneNumberChanged;
|
||||||
|
const factory CheckPhoneFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
part of 'check_phone_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CheckPhoneFormState with _$CheckPhoneFormState {
|
||||||
|
const factory CheckPhoneFormState({
|
||||||
|
required String phoneNumber,
|
||||||
|
required Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
@Default(false) bool showErrorMessages,
|
||||||
|
}) = _CheckPhoneFormState;
|
||||||
|
|
||||||
|
factory CheckPhoneFormState.initial() =>
|
||||||
|
CheckPhoneFormState(phoneNumber: '', failureOrCheckPhoneOption: none());
|
||||||
|
}
|
||||||
69
lib/application/auth/register_form/register_form_bloc.dart
Normal file
69
lib/application/auth/register_form/register_form_bloc.dart
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
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 'register_form_event.dart';
|
||||||
|
part 'register_form_state.dart';
|
||||||
|
part 'register_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class RegisterFormBloc extends Bloc<RegisterFormEvent, RegisterFormState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
RegisterFormBloc(this._repository) : super(RegisterFormState.initial()) {
|
||||||
|
on<RegisterFormEvent>(_onRegisterFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onRegisterFormEvent(
|
||||||
|
RegisterFormEvent event,
|
||||||
|
Emitter<RegisterFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
phoneNumberChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
phoneNumber: e.phoneNumber,
|
||||||
|
failureOrRegisterOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
nameChanged: (e) async {
|
||||||
|
emit(state.copyWith(name: e.name, failureOrRegisterOption: none()));
|
||||||
|
},
|
||||||
|
birthDateChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
birthDate: e.birthDate,
|
||||||
|
failureOrRegisterOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
submitted: (e) async {
|
||||||
|
Either<AuthFailure, Register>? failureOrRegister;
|
||||||
|
emit(
|
||||||
|
state.copyWith(isSubmitting: true, failureOrRegisterOption: none()),
|
||||||
|
);
|
||||||
|
|
||||||
|
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||||
|
final nameValid = state.name.isNotEmpty;
|
||||||
|
|
||||||
|
if (phoneNumberValid && nameValid) {
|
||||||
|
failureOrRegister = await _repository.register(
|
||||||
|
phoneNumber: state.phoneNumber,
|
||||||
|
name: state.name,
|
||||||
|
birthDate: state.birthDate,
|
||||||
|
);
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrRegisterOption: optionOf(failureOrRegister),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,944 @@
|
|||||||
|
// 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 'register_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 _$RegisterFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String name) nameChanged,
|
||||||
|
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String name)? nameChanged,
|
||||||
|
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String name)? nameChanged,
|
||||||
|
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_NameChanged value) nameChanged,
|
||||||
|
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $RegisterFormEventCopyWith<$Res> {
|
||||||
|
factory $RegisterFormEventCopyWith(
|
||||||
|
RegisterFormEvent value,
|
||||||
|
$Res Function(RegisterFormEvent) then,
|
||||||
|
) = _$RegisterFormEventCopyWithImpl<$Res, RegisterFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$RegisterFormEventCopyWithImpl<$Res, $Val extends RegisterFormEvent>
|
||||||
|
implements $RegisterFormEventCopyWith<$Res> {
|
||||||
|
_$RegisterFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$PhoneNumberChangedImplCopyWith(
|
||||||
|
_$PhoneNumberChangedImpl value,
|
||||||
|
$Res Function(_$PhoneNumberChangedImpl) then,
|
||||||
|
) = __$$PhoneNumberChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String phoneNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$PhoneNumberChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||||
|
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||||
|
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||||
|
_$PhoneNumberChangedImpl _value,
|
||||||
|
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? phoneNumber = null}) {
|
||||||
|
return _then(
|
||||||
|
_$PhoneNumberChangedImpl(
|
||||||
|
null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$PhoneNumberChangedImpl implements _PhoneNumberChanged {
|
||||||
|
const _$PhoneNumberChangedImpl(this.phoneNumber);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterFormEvent.phoneNumberChanged(phoneNumber: $phoneNumber)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$PhoneNumberChangedImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||||
|
__$$PhoneNumberChangedImplCopyWithImpl<_$PhoneNumberChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String name) nameChanged,
|
||||||
|
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String name)? nameChanged,
|
||||||
|
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String name)? nameChanged,
|
||||||
|
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (phoneNumberChanged != null) {
|
||||||
|
return phoneNumberChanged(phoneNumber);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_NameChanged value) nameChanged,
|
||||||
|
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (phoneNumberChanged != null) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PhoneNumberChanged implements RegisterFormEvent {
|
||||||
|
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||||
|
_$PhoneNumberChangedImpl;
|
||||||
|
|
||||||
|
String get phoneNumber;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$NameChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$NameChangedImplCopyWith(
|
||||||
|
_$NameChangedImpl value,
|
||||||
|
$Res Function(_$NameChangedImpl) then,
|
||||||
|
) = __$$NameChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String name});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$NameChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterFormEventCopyWithImpl<$Res, _$NameChangedImpl>
|
||||||
|
implements _$$NameChangedImplCopyWith<$Res> {
|
||||||
|
__$$NameChangedImplCopyWithImpl(
|
||||||
|
_$NameChangedImpl _value,
|
||||||
|
$Res Function(_$NameChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? name = null}) {
|
||||||
|
return _then(
|
||||||
|
_$NameChangedImpl(
|
||||||
|
null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$NameChangedImpl implements _NameChanged {
|
||||||
|
const _$NameChangedImpl(this.name);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String name;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterFormEvent.nameChanged(name: $name)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$NameChangedImpl &&
|
||||||
|
(identical(other.name, name) || other.name == name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, name);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$NameChangedImplCopyWith<_$NameChangedImpl> get copyWith =>
|
||||||
|
__$$NameChangedImplCopyWithImpl<_$NameChangedImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String name) nameChanged,
|
||||||
|
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return nameChanged(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String name)? nameChanged,
|
||||||
|
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return nameChanged?.call(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String name)? nameChanged,
|
||||||
|
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (nameChanged != null) {
|
||||||
|
return nameChanged(name);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_NameChanged value) nameChanged,
|
||||||
|
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return nameChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return nameChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (nameChanged != null) {
|
||||||
|
return nameChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _NameChanged implements RegisterFormEvent {
|
||||||
|
const factory _NameChanged(final String name) = _$NameChangedImpl;
|
||||||
|
|
||||||
|
String get name;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$NameChangedImplCopyWith<_$NameChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$BirthDateChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$BirthDateChangedImplCopyWith(
|
||||||
|
_$BirthDateChangedImpl value,
|
||||||
|
$Res Function(_$BirthDateChangedImpl) then,
|
||||||
|
) = __$$BirthDateChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({DateTime birthDate});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$BirthDateChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterFormEventCopyWithImpl<$Res, _$BirthDateChangedImpl>
|
||||||
|
implements _$$BirthDateChangedImplCopyWith<$Res> {
|
||||||
|
__$$BirthDateChangedImplCopyWithImpl(
|
||||||
|
_$BirthDateChangedImpl _value,
|
||||||
|
$Res Function(_$BirthDateChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? birthDate = null}) {
|
||||||
|
return _then(
|
||||||
|
_$BirthDateChangedImpl(
|
||||||
|
null == birthDate
|
||||||
|
? _value.birthDate
|
||||||
|
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$BirthDateChangedImpl implements _BirthDateChanged {
|
||||||
|
const _$BirthDateChangedImpl(this.birthDate);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime birthDate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterFormEvent.birthDateChanged(birthDate: $birthDate)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$BirthDateChangedImpl &&
|
||||||
|
(identical(other.birthDate, birthDate) ||
|
||||||
|
other.birthDate == birthDate));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, birthDate);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$BirthDateChangedImplCopyWith<_$BirthDateChangedImpl> get copyWith =>
|
||||||
|
__$$BirthDateChangedImplCopyWithImpl<_$BirthDateChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String name) nameChanged,
|
||||||
|
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return birthDateChanged(birthDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String name)? nameChanged,
|
||||||
|
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return birthDateChanged?.call(birthDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String name)? nameChanged,
|
||||||
|
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (birthDateChanged != null) {
|
||||||
|
return birthDateChanged(birthDate);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_NameChanged value) nameChanged,
|
||||||
|
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return birthDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return birthDateChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (birthDateChanged != null) {
|
||||||
|
return birthDateChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _BirthDateChanged implements RegisterFormEvent {
|
||||||
|
const factory _BirthDateChanged(final DateTime birthDate) =
|
||||||
|
_$BirthDateChangedImpl;
|
||||||
|
|
||||||
|
DateTime get birthDate;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$BirthDateChangedImplCopyWith<_$BirthDateChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterFormEvent.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 phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String name) nameChanged,
|
||||||
|
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String name)? nameChanged,
|
||||||
|
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String name)? nameChanged,
|
||||||
|
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_NameChanged value) nameChanged,
|
||||||
|
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements RegisterFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$RegisterFormState {
|
||||||
|
String get phoneNumber => throw _privateConstructorUsedError;
|
||||||
|
String get name => throw _privateConstructorUsedError;
|
||||||
|
DateTime get birthDate => throw _privateConstructorUsedError;
|
||||||
|
Option<Either<AuthFailure, Register>> get failureOrRegisterOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$RegisterFormStateCopyWith<RegisterFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $RegisterFormStateCopyWith<$Res> {
|
||||||
|
factory $RegisterFormStateCopyWith(
|
||||||
|
RegisterFormState value,
|
||||||
|
$Res Function(RegisterFormState) then,
|
||||||
|
) = _$RegisterFormStateCopyWithImpl<$Res, RegisterFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
String name,
|
||||||
|
DateTime birthDate,
|
||||||
|
Option<Either<AuthFailure, Register>> failureOrRegisterOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$RegisterFormStateCopyWithImpl<$Res, $Val extends RegisterFormState>
|
||||||
|
implements $RegisterFormStateCopyWith<$Res> {
|
||||||
|
_$RegisterFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? name = null,
|
||||||
|
Object? birthDate = null,
|
||||||
|
Object? failureOrRegisterOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
birthDate: null == birthDate
|
||||||
|
? _value.birthDate
|
||||||
|
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
failureOrRegisterOption: null == failureOrRegisterOption
|
||||||
|
? _value.failureOrRegisterOption
|
||||||
|
: failureOrRegisterOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Register>>,
|
||||||
|
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 _$$RegisterFormStateImplCopyWith<$Res>
|
||||||
|
implements $RegisterFormStateCopyWith<$Res> {
|
||||||
|
factory _$$RegisterFormStateImplCopyWith(
|
||||||
|
_$RegisterFormStateImpl value,
|
||||||
|
$Res Function(_$RegisterFormStateImpl) then,
|
||||||
|
) = __$$RegisterFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
String name,
|
||||||
|
DateTime birthDate,
|
||||||
|
Option<Either<AuthFailure, Register>> failureOrRegisterOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RegisterFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterFormStateCopyWithImpl<$Res, _$RegisterFormStateImpl>
|
||||||
|
implements _$$RegisterFormStateImplCopyWith<$Res> {
|
||||||
|
__$$RegisterFormStateImplCopyWithImpl(
|
||||||
|
_$RegisterFormStateImpl _value,
|
||||||
|
$Res Function(_$RegisterFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? name = null,
|
||||||
|
Object? birthDate = null,
|
||||||
|
Object? failureOrRegisterOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$RegisterFormStateImpl(
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
birthDate: null == birthDate
|
||||||
|
? _value.birthDate
|
||||||
|
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
failureOrRegisterOption: null == failureOrRegisterOption
|
||||||
|
? _value.failureOrRegisterOption
|
||||||
|
: failureOrRegisterOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Register>>,
|
||||||
|
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 _$RegisterFormStateImpl implements _RegisterFormState {
|
||||||
|
const _$RegisterFormStateImpl({
|
||||||
|
required this.phoneNumber,
|
||||||
|
required this.name,
|
||||||
|
required this.birthDate,
|
||||||
|
required this.failureOrRegisterOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
this.showErrorMessages = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
@override
|
||||||
|
final String name;
|
||||||
|
@override
|
||||||
|
final DateTime birthDate;
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, Register>> failureOrRegisterOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool showErrorMessages;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterFormState(phoneNumber: $phoneNumber, name: $name, birthDate: $birthDate, failureOrRegisterOption: $failureOrRegisterOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RegisterFormStateImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber) &&
|
||||||
|
(identical(other.name, name) || other.name == name) &&
|
||||||
|
(identical(other.birthDate, birthDate) ||
|
||||||
|
other.birthDate == birthDate) &&
|
||||||
|
(identical(
|
||||||
|
other.failureOrRegisterOption,
|
||||||
|
failureOrRegisterOption,
|
||||||
|
) ||
|
||||||
|
other.failureOrRegisterOption == failureOrRegisterOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting) &&
|
||||||
|
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||||
|
other.showErrorMessages == showErrorMessages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
phoneNumber,
|
||||||
|
name,
|
||||||
|
birthDate,
|
||||||
|
failureOrRegisterOption,
|
||||||
|
isSubmitting,
|
||||||
|
showErrorMessages,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RegisterFormStateImplCopyWith<_$RegisterFormStateImpl> get copyWith =>
|
||||||
|
__$$RegisterFormStateImplCopyWithImpl<_$RegisterFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RegisterFormState implements RegisterFormState {
|
||||||
|
const factory _RegisterFormState({
|
||||||
|
required final String phoneNumber,
|
||||||
|
required final String name,
|
||||||
|
required final DateTime birthDate,
|
||||||
|
required final Option<Either<AuthFailure, Register>>
|
||||||
|
failureOrRegisterOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
final bool showErrorMessages,
|
||||||
|
}) = _$RegisterFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get phoneNumber;
|
||||||
|
@override
|
||||||
|
String get name;
|
||||||
|
@override
|
||||||
|
DateTime get birthDate;
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, Register>> get failureOrRegisterOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
@override
|
||||||
|
bool get showErrorMessages;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RegisterFormStateImplCopyWith<_$RegisterFormStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
11
lib/application/auth/register_form/register_form_event.dart
Normal file
11
lib/application/auth/register_form/register_form_event.dart
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
part of 'register_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class RegisterFormEvent with _$RegisterFormEvent {
|
||||||
|
const factory RegisterFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||||
|
_PhoneNumberChanged;
|
||||||
|
const factory RegisterFormEvent.nameChanged(String name) = _NameChanged;
|
||||||
|
const factory RegisterFormEvent.birthDateChanged(DateTime birthDate) =
|
||||||
|
_BirthDateChanged;
|
||||||
|
const factory RegisterFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
20
lib/application/auth/register_form/register_form_state.dart
Normal file
20
lib/application/auth/register_form/register_form_state.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
part of 'register_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class RegisterFormState with _$RegisterFormState {
|
||||||
|
const factory RegisterFormState({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String name,
|
||||||
|
required DateTime birthDate,
|
||||||
|
required Option<Either<AuthFailure, Register>> failureOrRegisterOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
@Default(false) bool showErrorMessages,
|
||||||
|
}) = _RegisterFormState;
|
||||||
|
|
||||||
|
factory RegisterFormState.initial() => RegisterFormState(
|
||||||
|
phoneNumber: '',
|
||||||
|
failureOrRegisterOption: none(),
|
||||||
|
name: '',
|
||||||
|
birthDate: DateTime.now(),
|
||||||
|
);
|
||||||
|
}
|
||||||
33
lib/common/extension/date_extension.dart
Normal file
33
lib/common/extension/date_extension.dart
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
part of 'extension.dart';
|
||||||
|
|
||||||
|
extension DateTimeIndonesia on DateTime {
|
||||||
|
/// Format: 13 Agustus 2025
|
||||||
|
String get toDate {
|
||||||
|
return DateFormat('d MMMM yyyy', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format: 13 Agustus 2025 20:00
|
||||||
|
String get toDatetime {
|
||||||
|
return DateFormat('d MMMM yyyy HH:mm', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format: Rabu, 13 Agustus 2025
|
||||||
|
String get toDayDate {
|
||||||
|
return DateFormat('EEEE, d MMMM yyyy', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format: 13/08/2025
|
||||||
|
String get toShortDate {
|
||||||
|
return DateFormat('dd/MM/yyyy', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format: 13-08-2025
|
||||||
|
String get toServerDate {
|
||||||
|
return DateFormat('dd-MM-yyyy', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format jam: 14:30
|
||||||
|
String get toHourMinute {
|
||||||
|
return DateFormat('HH:mm', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1 +1,18 @@
|
|||||||
// TODO: define your code
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import '../../domain/auth/auth.dart';
|
||||||
|
|
||||||
|
part 'date_extension.dart';
|
||||||
|
|
||||||
|
extension StringExt on String {
|
||||||
|
CheckPhoneStatus toCheckPhoneStatus() {
|
||||||
|
switch (this) {
|
||||||
|
case 'NO_REGISTERED':
|
||||||
|
return CheckPhoneStatus.notRegistered;
|
||||||
|
case 'PASSWORD_REQUIRED':
|
||||||
|
return CheckPhoneStatus.passwordRequired;
|
||||||
|
default:
|
||||||
|
return CheckPhoneStatus.unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
4
lib/common/url/api_path.dart
Normal file
4
lib/common/url/api_path.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class ApiPath {
|
||||||
|
static String checkPhone = '/api/v1/customer-auth/check-phone';
|
||||||
|
static String register = '/api/v1/customer-auth/register/start';
|
||||||
|
}
|
||||||
24
lib/domain/auth/auth.dart
Normal file
24
lib/domain/auth/auth.dart
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
|
||||||
|
import '../../common/api/api_failure.dart';
|
||||||
|
|
||||||
|
part 'auth.freezed.dart';
|
||||||
|
|
||||||
|
part 'entities/check_phone_entity.dart';
|
||||||
|
part 'entities/register_entity.dart';
|
||||||
|
part 'failures/auth_failure.dart';
|
||||||
|
part 'repositories/i_auth_repository.dart';
|
||||||
|
|
||||||
|
enum CheckPhoneStatus { notRegistered, passwordRequired, unknown }
|
||||||
|
|
||||||
|
extension CheckPhoneStatusX on CheckPhoneStatus {
|
||||||
|
String toStringType() => switch (this) {
|
||||||
|
CheckPhoneStatus.notRegistered => 'NOT_REGISTERED',
|
||||||
|
CheckPhoneStatus.passwordRequired => 'PASSWORD_REQUIRED',
|
||||||
|
CheckPhoneStatus.unknown => '',
|
||||||
|
};
|
||||||
|
|
||||||
|
bool get isNotRegistered => this == CheckPhoneStatus.notRegistered;
|
||||||
|
bool get isPasswordRequired => this == CheckPhoneStatus.passwordRequired;
|
||||||
|
}
|
||||||
915
lib/domain/auth/auth.freezed.dart
Normal file
915
lib/domain/auth/auth.freezed.dart
Normal file
@ -0,0 +1,915 @@
|
|||||||
|
// 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 'auth.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 _$CheckPhone {
|
||||||
|
String get status => throw _privateConstructorUsedError;
|
||||||
|
String get message => throw _privateConstructorUsedError;
|
||||||
|
String get phoneNumber => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhone
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CheckPhoneCopyWith<CheckPhone> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CheckPhoneCopyWith<$Res> {
|
||||||
|
factory $CheckPhoneCopyWith(
|
||||||
|
CheckPhone value,
|
||||||
|
$Res Function(CheckPhone) then,
|
||||||
|
) = _$CheckPhoneCopyWithImpl<$Res, CheckPhone>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String status, String message, String phoneNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CheckPhoneCopyWithImpl<$Res, $Val extends CheckPhone>
|
||||||
|
implements $CheckPhoneCopyWith<$Res> {
|
||||||
|
_$CheckPhoneCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhone
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = null,
|
||||||
|
Object? message = null,
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
message: null == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CheckPhoneImplCopyWith<$Res>
|
||||||
|
implements $CheckPhoneCopyWith<$Res> {
|
||||||
|
factory _$$CheckPhoneImplCopyWith(
|
||||||
|
_$CheckPhoneImpl value,
|
||||||
|
$Res Function(_$CheckPhoneImpl) then,
|
||||||
|
) = __$$CheckPhoneImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({String status, String message, String phoneNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CheckPhoneImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckPhoneCopyWithImpl<$Res, _$CheckPhoneImpl>
|
||||||
|
implements _$$CheckPhoneImplCopyWith<$Res> {
|
||||||
|
__$$CheckPhoneImplCopyWithImpl(
|
||||||
|
_$CheckPhoneImpl _value,
|
||||||
|
$Res Function(_$CheckPhoneImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhone
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = null,
|
||||||
|
Object? message = null,
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$CheckPhoneImpl(
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
message: null == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$CheckPhoneImpl implements _CheckPhone {
|
||||||
|
const _$CheckPhoneImpl({
|
||||||
|
required this.status,
|
||||||
|
required this.message,
|
||||||
|
required this.phoneNumber,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String status;
|
||||||
|
@override
|
||||||
|
final String message;
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckPhone(status: $status, message: $message, phoneNumber: $phoneNumber)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CheckPhoneImpl &&
|
||||||
|
(identical(other.status, status) || other.status == status) &&
|
||||||
|
(identical(other.message, message) || other.message == message) &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, status, message, phoneNumber);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhone
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CheckPhoneImplCopyWith<_$CheckPhoneImpl> get copyWith =>
|
||||||
|
__$$CheckPhoneImplCopyWithImpl<_$CheckPhoneImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CheckPhone implements CheckPhone {
|
||||||
|
const factory _CheckPhone({
|
||||||
|
required final String status,
|
||||||
|
required final String message,
|
||||||
|
required final String phoneNumber,
|
||||||
|
}) = _$CheckPhoneImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get status;
|
||||||
|
@override
|
||||||
|
String get message;
|
||||||
|
@override
|
||||||
|
String get phoneNumber;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhone
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CheckPhoneImplCopyWith<_$CheckPhoneImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$Register {
|
||||||
|
String get status => throw _privateConstructorUsedError;
|
||||||
|
String get message => throw _privateConstructorUsedError;
|
||||||
|
String get registrationToken => throw _privateConstructorUsedError;
|
||||||
|
String get otpToken => throw _privateConstructorUsedError;
|
||||||
|
int get expiresIn => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of Register
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$RegisterCopyWith<Register> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $RegisterCopyWith<$Res> {
|
||||||
|
factory $RegisterCopyWith(Register value, $Res Function(Register) then) =
|
||||||
|
_$RegisterCopyWithImpl<$Res, Register>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String status,
|
||||||
|
String message,
|
||||||
|
String registrationToken,
|
||||||
|
String otpToken,
|
||||||
|
int expiresIn,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$RegisterCopyWithImpl<$Res, $Val extends Register>
|
||||||
|
implements $RegisterCopyWith<$Res> {
|
||||||
|
_$RegisterCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of Register
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = null,
|
||||||
|
Object? message = null,
|
||||||
|
Object? registrationToken = null,
|
||||||
|
Object? otpToken = null,
|
||||||
|
Object? expiresIn = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
message: null == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
registrationToken: null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
otpToken: null == otpToken
|
||||||
|
? _value.otpToken
|
||||||
|
: otpToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
expiresIn: null == expiresIn
|
||||||
|
? _value.expiresIn
|
||||||
|
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RegisterImplCopyWith<$Res>
|
||||||
|
implements $RegisterCopyWith<$Res> {
|
||||||
|
factory _$$RegisterImplCopyWith(
|
||||||
|
_$RegisterImpl value,
|
||||||
|
$Res Function(_$RegisterImpl) then,
|
||||||
|
) = __$$RegisterImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String status,
|
||||||
|
String message,
|
||||||
|
String registrationToken,
|
||||||
|
String otpToken,
|
||||||
|
int expiresIn,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RegisterImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterCopyWithImpl<$Res, _$RegisterImpl>
|
||||||
|
implements _$$RegisterImplCopyWith<$Res> {
|
||||||
|
__$$RegisterImplCopyWithImpl(
|
||||||
|
_$RegisterImpl _value,
|
||||||
|
$Res Function(_$RegisterImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of Register
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = null,
|
||||||
|
Object? message = null,
|
||||||
|
Object? registrationToken = null,
|
||||||
|
Object? otpToken = null,
|
||||||
|
Object? expiresIn = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$RegisterImpl(
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
message: null == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
registrationToken: null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
otpToken: null == otpToken
|
||||||
|
? _value.otpToken
|
||||||
|
: otpToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
expiresIn: null == expiresIn
|
||||||
|
? _value.expiresIn
|
||||||
|
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RegisterImpl implements _Register {
|
||||||
|
const _$RegisterImpl({
|
||||||
|
required this.status,
|
||||||
|
required this.message,
|
||||||
|
required this.registrationToken,
|
||||||
|
required this.otpToken,
|
||||||
|
required this.expiresIn,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String status;
|
||||||
|
@override
|
||||||
|
final String message;
|
||||||
|
@override
|
||||||
|
final String registrationToken;
|
||||||
|
@override
|
||||||
|
final String otpToken;
|
||||||
|
@override
|
||||||
|
final int expiresIn;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Register(status: $status, message: $message, registrationToken: $registrationToken, otpToken: $otpToken, expiresIn: $expiresIn)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RegisterImpl &&
|
||||||
|
(identical(other.status, status) || other.status == status) &&
|
||||||
|
(identical(other.message, message) || other.message == message) &&
|
||||||
|
(identical(other.registrationToken, registrationToken) ||
|
||||||
|
other.registrationToken == registrationToken) &&
|
||||||
|
(identical(other.otpToken, otpToken) ||
|
||||||
|
other.otpToken == otpToken) &&
|
||||||
|
(identical(other.expiresIn, expiresIn) ||
|
||||||
|
other.expiresIn == expiresIn));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
status,
|
||||||
|
message,
|
||||||
|
registrationToken,
|
||||||
|
otpToken,
|
||||||
|
expiresIn,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of Register
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RegisterImplCopyWith<_$RegisterImpl> get copyWith =>
|
||||||
|
__$$RegisterImplCopyWithImpl<_$RegisterImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Register implements Register {
|
||||||
|
const factory _Register({
|
||||||
|
required final String status,
|
||||||
|
required final String message,
|
||||||
|
required final String registrationToken,
|
||||||
|
required final String otpToken,
|
||||||
|
required final int expiresIn,
|
||||||
|
}) = _$RegisterImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get status;
|
||||||
|
@override
|
||||||
|
String get message;
|
||||||
|
@override
|
||||||
|
String get registrationToken;
|
||||||
|
@override
|
||||||
|
String get otpToken;
|
||||||
|
@override
|
||||||
|
int get expiresIn;
|
||||||
|
|
||||||
|
/// Create a copy of Register
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RegisterImplCopyWith<_$RegisterImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$AuthFailure {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(ApiFailure failure) serverError,
|
||||||
|
required TResult Function() unexpectedError,
|
||||||
|
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(ApiFailure failure)? serverError,
|
||||||
|
TResult? Function()? unexpectedError,
|
||||||
|
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(ApiFailure failure)? serverError,
|
||||||
|
TResult Function()? unexpectedError,
|
||||||
|
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_ServerError value) serverError,
|
||||||
|
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||||
|
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_ServerError value)? serverError,
|
||||||
|
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_ServerError value)? serverError,
|
||||||
|
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $AuthFailureCopyWith<$Res> {
|
||||||
|
factory $AuthFailureCopyWith(
|
||||||
|
AuthFailure value,
|
||||||
|
$Res Function(AuthFailure) then,
|
||||||
|
) = _$AuthFailureCopyWithImpl<$Res, AuthFailure>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$AuthFailureCopyWithImpl<$Res, $Val extends AuthFailure>
|
||||||
|
implements $AuthFailureCopyWith<$Res> {
|
||||||
|
_$AuthFailureCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ServerErrorImplCopyWith<$Res> {
|
||||||
|
factory _$$ServerErrorImplCopyWith(
|
||||||
|
_$ServerErrorImpl value,
|
||||||
|
$Res Function(_$ServerErrorImpl) then,
|
||||||
|
) = __$$ServerErrorImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({ApiFailure failure});
|
||||||
|
|
||||||
|
$ApiFailureCopyWith<$Res> get failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ServerErrorImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthFailureCopyWithImpl<$Res, _$ServerErrorImpl>
|
||||||
|
implements _$$ServerErrorImplCopyWith<$Res> {
|
||||||
|
__$$ServerErrorImplCopyWithImpl(
|
||||||
|
_$ServerErrorImpl _value,
|
||||||
|
$Res Function(_$ServerErrorImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? failure = null}) {
|
||||||
|
return _then(
|
||||||
|
_$ServerErrorImpl(
|
||||||
|
null == failure
|
||||||
|
? _value.failure
|
||||||
|
: failure // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ApiFailure,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ApiFailureCopyWith<$Res> get failure {
|
||||||
|
return $ApiFailureCopyWith<$Res>(_value.failure, (value) {
|
||||||
|
return _then(_value.copyWith(failure: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ServerErrorImpl implements _ServerError {
|
||||||
|
const _$ServerErrorImpl(this.failure);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final ApiFailure failure;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthFailure.serverError(failure: $failure)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ServerErrorImpl &&
|
||||||
|
(identical(other.failure, failure) || other.failure == failure));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, failure);
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ServerErrorImplCopyWith<_$ServerErrorImpl> get copyWith =>
|
||||||
|
__$$ServerErrorImplCopyWithImpl<_$ServerErrorImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(ApiFailure failure) serverError,
|
||||||
|
required TResult Function() unexpectedError,
|
||||||
|
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return serverError(failure);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(ApiFailure failure)? serverError,
|
||||||
|
TResult? Function()? unexpectedError,
|
||||||
|
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return serverError?.call(failure);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(ApiFailure failure)? serverError,
|
||||||
|
TResult Function()? unexpectedError,
|
||||||
|
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (serverError != null) {
|
||||||
|
return serverError(failure);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_ServerError value) serverError,
|
||||||
|
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||||
|
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return serverError(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_ServerError value)? serverError,
|
||||||
|
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return serverError?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_ServerError value)? serverError,
|
||||||
|
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (serverError != null) {
|
||||||
|
return serverError(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ServerError implements AuthFailure {
|
||||||
|
const factory _ServerError(final ApiFailure failure) = _$ServerErrorImpl;
|
||||||
|
|
||||||
|
ApiFailure get failure;
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ServerErrorImplCopyWith<_$ServerErrorImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$UnexpectedErrorImplCopyWith<$Res> {
|
||||||
|
factory _$$UnexpectedErrorImplCopyWith(
|
||||||
|
_$UnexpectedErrorImpl value,
|
||||||
|
$Res Function(_$UnexpectedErrorImpl) then,
|
||||||
|
) = __$$UnexpectedErrorImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$UnexpectedErrorImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthFailureCopyWithImpl<$Res, _$UnexpectedErrorImpl>
|
||||||
|
implements _$$UnexpectedErrorImplCopyWith<$Res> {
|
||||||
|
__$$UnexpectedErrorImplCopyWithImpl(
|
||||||
|
_$UnexpectedErrorImpl _value,
|
||||||
|
$Res Function(_$UnexpectedErrorImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$UnexpectedErrorImpl implements _UnexpectedError {
|
||||||
|
const _$UnexpectedErrorImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthFailure.unexpectedError()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$UnexpectedErrorImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(ApiFailure failure) serverError,
|
||||||
|
required TResult Function() unexpectedError,
|
||||||
|
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return unexpectedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(ApiFailure failure)? serverError,
|
||||||
|
TResult? Function()? unexpectedError,
|
||||||
|
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return unexpectedError?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(ApiFailure failure)? serverError,
|
||||||
|
TResult Function()? unexpectedError,
|
||||||
|
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (unexpectedError != null) {
|
||||||
|
return unexpectedError();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_ServerError value) serverError,
|
||||||
|
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||||
|
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return unexpectedError(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_ServerError value)? serverError,
|
||||||
|
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return unexpectedError?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_ServerError value)? serverError,
|
||||||
|
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (unexpectedError != null) {
|
||||||
|
return unexpectedError(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _UnexpectedError implements AuthFailure {
|
||||||
|
const factory _UnexpectedError() = _$UnexpectedErrorImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$DynamicErrorMessageImplCopyWith<$Res> {
|
||||||
|
factory _$$DynamicErrorMessageImplCopyWith(
|
||||||
|
_$DynamicErrorMessageImpl value,
|
||||||
|
$Res Function(_$DynamicErrorMessageImpl) then,
|
||||||
|
) = __$$DynamicErrorMessageImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String erroMessage});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$DynamicErrorMessageImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthFailureCopyWithImpl<$Res, _$DynamicErrorMessageImpl>
|
||||||
|
implements _$$DynamicErrorMessageImplCopyWith<$Res> {
|
||||||
|
__$$DynamicErrorMessageImplCopyWithImpl(
|
||||||
|
_$DynamicErrorMessageImpl _value,
|
||||||
|
$Res Function(_$DynamicErrorMessageImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? erroMessage = null}) {
|
||||||
|
return _then(
|
||||||
|
_$DynamicErrorMessageImpl(
|
||||||
|
null == erroMessage
|
||||||
|
? _value.erroMessage
|
||||||
|
: erroMessage // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
|
||||||
|
const _$DynamicErrorMessageImpl(this.erroMessage);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String erroMessage;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthFailure.dynamicErrorMessage(erroMessage: $erroMessage)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$DynamicErrorMessageImpl &&
|
||||||
|
(identical(other.erroMessage, erroMessage) ||
|
||||||
|
other.erroMessage == erroMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, erroMessage);
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
||||||
|
__$$DynamicErrorMessageImplCopyWithImpl<_$DynamicErrorMessageImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(ApiFailure failure) serverError,
|
||||||
|
required TResult Function() unexpectedError,
|
||||||
|
required TResult Function(String erroMessage) dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return dynamicErrorMessage(erroMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(ApiFailure failure)? serverError,
|
||||||
|
TResult? Function()? unexpectedError,
|
||||||
|
TResult? Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return dynamicErrorMessage?.call(erroMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(ApiFailure failure)? serverError,
|
||||||
|
TResult Function()? unexpectedError,
|
||||||
|
TResult Function(String erroMessage)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (dynamicErrorMessage != null) {
|
||||||
|
return dynamicErrorMessage(erroMessage);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_ServerError value) serverError,
|
||||||
|
required TResult Function(_UnexpectedError value) unexpectedError,
|
||||||
|
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return dynamicErrorMessage(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_ServerError value)? serverError,
|
||||||
|
TResult? Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
}) {
|
||||||
|
return dynamicErrorMessage?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_ServerError value)? serverError,
|
||||||
|
TResult Function(_UnexpectedError value)? unexpectedError,
|
||||||
|
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (dynamicErrorMessage != null) {
|
||||||
|
return dynamicErrorMessage(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _DynamicErrorMessage implements AuthFailure {
|
||||||
|
const factory _DynamicErrorMessage(final String erroMessage) =
|
||||||
|
_$DynamicErrorMessageImpl;
|
||||||
|
|
||||||
|
String get erroMessage;
|
||||||
|
|
||||||
|
/// Create a copy of AuthFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
13
lib/domain/auth/entities/check_phone_entity.dart
Normal file
13
lib/domain/auth/entities/check_phone_entity.dart
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CheckPhone with _$CheckPhone {
|
||||||
|
const factory CheckPhone({
|
||||||
|
required String status,
|
||||||
|
required String message,
|
||||||
|
required String phoneNumber,
|
||||||
|
}) = _CheckPhone;
|
||||||
|
|
||||||
|
factory CheckPhone.empty() =>
|
||||||
|
const CheckPhone(status: '', message: '', phoneNumber: '');
|
||||||
|
}
|
||||||
20
lib/domain/auth/entities/register_entity.dart
Normal file
20
lib/domain/auth/entities/register_entity.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Register with _$Register {
|
||||||
|
const factory Register({
|
||||||
|
required String status,
|
||||||
|
required String message,
|
||||||
|
required String registrationToken,
|
||||||
|
required String otpToken,
|
||||||
|
required int expiresIn,
|
||||||
|
}) = _Register;
|
||||||
|
|
||||||
|
factory Register.empty() => const Register(
|
||||||
|
status: '',
|
||||||
|
message: '',
|
||||||
|
registrationToken: '',
|
||||||
|
otpToken: '',
|
||||||
|
expiresIn: 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
9
lib/domain/auth/failures/auth_failure.dart
Normal file
9
lib/domain/auth/failures/auth_failure.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class AuthFailure with _$AuthFailure {
|
||||||
|
const factory AuthFailure.serverError(ApiFailure failure) = _ServerError;
|
||||||
|
const factory AuthFailure.unexpectedError() = _UnexpectedError;
|
||||||
|
const factory AuthFailure.dynamicErrorMessage(String erroMessage) =
|
||||||
|
_DynamicErrorMessage;
|
||||||
|
}
|
||||||
13
lib/domain/auth/repositories/i_auth_repository.dart
Normal file
13
lib/domain/auth/repositories/i_auth_repository.dart
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
abstract class IAuthRepository {
|
||||||
|
Future<Either<AuthFailure, CheckPhone>> checkPhone({
|
||||||
|
required String phoneNumber,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, Register>> register({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String name,
|
||||||
|
required DateTime birthDate,
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -9,12 +9,12 @@ abstract class Env {
|
|||||||
@dev
|
@dev
|
||||||
class DevEnv implements Env {
|
class DevEnv implements Env {
|
||||||
@override
|
@override
|
||||||
String get baseUrl => ''; // example value
|
String get baseUrl => 'http://192.168.1.30:4000'; // example value
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable(as: Env)
|
@Injectable(as: Env)
|
||||||
@prod
|
@prod
|
||||||
class ProdEnv implements Env {
|
class ProdEnv implements Env {
|
||||||
@override
|
@override
|
||||||
String get baseUrl => '';
|
String get baseUrl => 'https://enaklo-pos-be.altru.id';
|
||||||
}
|
}
|
||||||
|
|||||||
9
lib/infrastructure/auth/auth_dtos.dart
Normal file
9
lib/infrastructure/auth/auth_dtos.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../domain/auth/auth.dart';
|
||||||
|
|
||||||
|
part 'auth_dtos.freezed.dart';
|
||||||
|
part 'auth_dtos.g.dart';
|
||||||
|
|
||||||
|
part 'dto/check_phone_dto.dart';
|
||||||
|
part 'dto/register_dto.dart';
|
||||||
861
lib/infrastructure/auth/auth_dtos.freezed.dart
Normal file
861
lib/infrastructure/auth/auth_dtos.freezed.dart
Normal file
@ -0,0 +1,861 @@
|
|||||||
|
// 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 'auth_dtos.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',
|
||||||
|
);
|
||||||
|
|
||||||
|
CheckPhoneDto _$CheckPhoneDtoFromJson(Map<String, dynamic> json) {
|
||||||
|
return _CheckPhoneDto.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CheckPhoneDto {
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
String? get status => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
String? get message => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
CheckPhoneDataDto? get data => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this CheckPhoneDto to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CheckPhoneDtoCopyWith<CheckPhoneDto> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CheckPhoneDtoCopyWith<$Res> {
|
||||||
|
factory $CheckPhoneDtoCopyWith(
|
||||||
|
CheckPhoneDto value,
|
||||||
|
$Res Function(CheckPhoneDto) then,
|
||||||
|
) = _$CheckPhoneDtoCopyWithImpl<$Res, CheckPhoneDto>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') CheckPhoneDataDto? data,
|
||||||
|
});
|
||||||
|
|
||||||
|
$CheckPhoneDataDtoCopyWith<$Res>? get data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CheckPhoneDtoCopyWithImpl<$Res, $Val extends CheckPhoneDto>
|
||||||
|
implements $CheckPhoneDtoCopyWith<$Res> {
|
||||||
|
_$CheckPhoneDtoCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = freezed,
|
||||||
|
Object? message = freezed,
|
||||||
|
Object? data = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
status: freezed == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
message: freezed == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
data: freezed == data
|
||||||
|
? _value.data
|
||||||
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as CheckPhoneDataDto?,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$CheckPhoneDataDtoCopyWith<$Res>? get data {
|
||||||
|
if (_value.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $CheckPhoneDataDtoCopyWith<$Res>(_value.data!, (value) {
|
||||||
|
return _then(_value.copyWith(data: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CheckPhoneDtoImplCopyWith<$Res>
|
||||||
|
implements $CheckPhoneDtoCopyWith<$Res> {
|
||||||
|
factory _$$CheckPhoneDtoImplCopyWith(
|
||||||
|
_$CheckPhoneDtoImpl value,
|
||||||
|
$Res Function(_$CheckPhoneDtoImpl) then,
|
||||||
|
) = __$$CheckPhoneDtoImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') CheckPhoneDataDto? data,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$CheckPhoneDataDtoCopyWith<$Res>? get data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CheckPhoneDtoImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckPhoneDtoCopyWithImpl<$Res, _$CheckPhoneDtoImpl>
|
||||||
|
implements _$$CheckPhoneDtoImplCopyWith<$Res> {
|
||||||
|
__$$CheckPhoneDtoImplCopyWithImpl(
|
||||||
|
_$CheckPhoneDtoImpl _value,
|
||||||
|
$Res Function(_$CheckPhoneDtoImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = freezed,
|
||||||
|
Object? message = freezed,
|
||||||
|
Object? data = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$CheckPhoneDtoImpl(
|
||||||
|
status: freezed == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
message: freezed == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
data: freezed == data
|
||||||
|
? _value.data
|
||||||
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as CheckPhoneDataDto?,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$CheckPhoneDtoImpl extends _CheckPhoneDto {
|
||||||
|
const _$CheckPhoneDtoImpl({
|
||||||
|
@JsonKey(name: 'status') this.status,
|
||||||
|
@JsonKey(name: 'message') this.message,
|
||||||
|
@JsonKey(name: 'data') this.data,
|
||||||
|
}) : super._();
|
||||||
|
|
||||||
|
factory _$CheckPhoneDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$CheckPhoneDtoImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
final String? status;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
final String? message;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
final CheckPhoneDataDto? data;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckPhoneDto(status: $status, message: $message, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CheckPhoneDtoImpl &&
|
||||||
|
(identical(other.status, status) || other.status == status) &&
|
||||||
|
(identical(other.message, message) || other.message == message) &&
|
||||||
|
(identical(other.data, data) || other.data == data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, status, message, data);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CheckPhoneDtoImplCopyWith<_$CheckPhoneDtoImpl> get copyWith =>
|
||||||
|
__$$CheckPhoneDtoImplCopyWithImpl<_$CheckPhoneDtoImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$CheckPhoneDtoImplToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CheckPhoneDto extends CheckPhoneDto {
|
||||||
|
const factory _CheckPhoneDto({
|
||||||
|
@JsonKey(name: 'status') final String? status,
|
||||||
|
@JsonKey(name: 'message') final String? message,
|
||||||
|
@JsonKey(name: 'data') final CheckPhoneDataDto? data,
|
||||||
|
}) = _$CheckPhoneDtoImpl;
|
||||||
|
const _CheckPhoneDto._() : super._();
|
||||||
|
|
||||||
|
factory _CheckPhoneDto.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$CheckPhoneDtoImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
String? get status;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
String? get message;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
CheckPhoneDataDto? get data;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CheckPhoneDtoImplCopyWith<_$CheckPhoneDtoImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckPhoneDataDto _$CheckPhoneDataDtoFromJson(Map<String, dynamic> json) {
|
||||||
|
return _CheckPhoneDataDto.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CheckPhoneDataDto {
|
||||||
|
@JsonKey(name: 'phone_number')
|
||||||
|
String? get phoneNumber => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this CheckPhoneDataDto to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CheckPhoneDataDtoCopyWith<CheckPhoneDataDto> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CheckPhoneDataDtoCopyWith<$Res> {
|
||||||
|
factory $CheckPhoneDataDtoCopyWith(
|
||||||
|
CheckPhoneDataDto value,
|
||||||
|
$Res Function(CheckPhoneDataDto) then,
|
||||||
|
) = _$CheckPhoneDataDtoCopyWithImpl<$Res, CheckPhoneDataDto>;
|
||||||
|
@useResult
|
||||||
|
$Res call({@JsonKey(name: 'phone_number') String? phoneNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CheckPhoneDataDtoCopyWithImpl<$Res, $Val extends CheckPhoneDataDto>
|
||||||
|
implements $CheckPhoneDataDtoCopyWith<$Res> {
|
||||||
|
_$CheckPhoneDataDtoCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? phoneNumber = freezed}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
phoneNumber: freezed == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CheckPhoneDataDtoImplCopyWith<$Res>
|
||||||
|
implements $CheckPhoneDataDtoCopyWith<$Res> {
|
||||||
|
factory _$$CheckPhoneDataDtoImplCopyWith(
|
||||||
|
_$CheckPhoneDataDtoImpl value,
|
||||||
|
$Res Function(_$CheckPhoneDataDtoImpl) then,
|
||||||
|
) = __$$CheckPhoneDataDtoImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({@JsonKey(name: 'phone_number') String? phoneNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CheckPhoneDataDtoImplCopyWithImpl<$Res>
|
||||||
|
extends _$CheckPhoneDataDtoCopyWithImpl<$Res, _$CheckPhoneDataDtoImpl>
|
||||||
|
implements _$$CheckPhoneDataDtoImplCopyWith<$Res> {
|
||||||
|
__$$CheckPhoneDataDtoImplCopyWithImpl(
|
||||||
|
_$CheckPhoneDataDtoImpl _value,
|
||||||
|
$Res Function(_$CheckPhoneDataDtoImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? phoneNumber = freezed}) {
|
||||||
|
return _then(
|
||||||
|
_$CheckPhoneDataDtoImpl(
|
||||||
|
phoneNumber: freezed == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$CheckPhoneDataDtoImpl implements _CheckPhoneDataDto {
|
||||||
|
const _$CheckPhoneDataDtoImpl({
|
||||||
|
@JsonKey(name: 'phone_number') this.phoneNumber,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory _$CheckPhoneDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$CheckPhoneDataDtoImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'phone_number')
|
||||||
|
final String? phoneNumber;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CheckPhoneDataDto(phoneNumber: $phoneNumber)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CheckPhoneDataDtoImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CheckPhoneDataDtoImplCopyWith<_$CheckPhoneDataDtoImpl> get copyWith =>
|
||||||
|
__$$CheckPhoneDataDtoImplCopyWithImpl<_$CheckPhoneDataDtoImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$CheckPhoneDataDtoImplToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CheckPhoneDataDto implements CheckPhoneDataDto {
|
||||||
|
const factory _CheckPhoneDataDto({
|
||||||
|
@JsonKey(name: 'phone_number') final String? phoneNumber,
|
||||||
|
}) = _$CheckPhoneDataDtoImpl;
|
||||||
|
|
||||||
|
factory _CheckPhoneDataDto.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$CheckPhoneDataDtoImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'phone_number')
|
||||||
|
String? get phoneNumber;
|
||||||
|
|
||||||
|
/// Create a copy of CheckPhoneDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CheckPhoneDataDtoImplCopyWith<_$CheckPhoneDataDtoImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterDto _$RegisterDtoFromJson(Map<String, dynamic> json) {
|
||||||
|
return _RegisterDto.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$RegisterDto {
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
String? get status => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
String? get message => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
RegisterDataDto? get data => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this RegisterDto to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$RegisterDtoCopyWith<RegisterDto> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $RegisterDtoCopyWith<$Res> {
|
||||||
|
factory $RegisterDtoCopyWith(
|
||||||
|
RegisterDto value,
|
||||||
|
$Res Function(RegisterDto) then,
|
||||||
|
) = _$RegisterDtoCopyWithImpl<$Res, RegisterDto>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') RegisterDataDto? data,
|
||||||
|
});
|
||||||
|
|
||||||
|
$RegisterDataDtoCopyWith<$Res>? get data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$RegisterDtoCopyWithImpl<$Res, $Val extends RegisterDto>
|
||||||
|
implements $RegisterDtoCopyWith<$Res> {
|
||||||
|
_$RegisterDtoCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = freezed,
|
||||||
|
Object? message = freezed,
|
||||||
|
Object? data = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
status: freezed == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
message: freezed == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
data: freezed == data
|
||||||
|
? _value.data
|
||||||
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as RegisterDataDto?,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$RegisterDataDtoCopyWith<$Res>? get data {
|
||||||
|
if (_value.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $RegisterDataDtoCopyWith<$Res>(_value.data!, (value) {
|
||||||
|
return _then(_value.copyWith(data: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RegisterDtoImplCopyWith<$Res>
|
||||||
|
implements $RegisterDtoCopyWith<$Res> {
|
||||||
|
factory _$$RegisterDtoImplCopyWith(
|
||||||
|
_$RegisterDtoImpl value,
|
||||||
|
$Res Function(_$RegisterDtoImpl) then,
|
||||||
|
) = __$$RegisterDtoImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') RegisterDataDto? data,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$RegisterDataDtoCopyWith<$Res>? get data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RegisterDtoImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterDtoCopyWithImpl<$Res, _$RegisterDtoImpl>
|
||||||
|
implements _$$RegisterDtoImplCopyWith<$Res> {
|
||||||
|
__$$RegisterDtoImplCopyWithImpl(
|
||||||
|
_$RegisterDtoImpl _value,
|
||||||
|
$Res Function(_$RegisterDtoImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? status = freezed,
|
||||||
|
Object? message = freezed,
|
||||||
|
Object? data = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$RegisterDtoImpl(
|
||||||
|
status: freezed == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
message: freezed == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
data: freezed == data
|
||||||
|
? _value.data
|
||||||
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as RegisterDataDto?,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$RegisterDtoImpl extends _RegisterDto {
|
||||||
|
const _$RegisterDtoImpl({
|
||||||
|
@JsonKey(name: 'status') this.status,
|
||||||
|
@JsonKey(name: 'message') this.message,
|
||||||
|
@JsonKey(name: 'data') this.data,
|
||||||
|
}) : super._();
|
||||||
|
|
||||||
|
factory _$RegisterDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$RegisterDtoImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
final String? status;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
final String? message;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
final RegisterDataDto? data;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterDto(status: $status, message: $message, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RegisterDtoImpl &&
|
||||||
|
(identical(other.status, status) || other.status == status) &&
|
||||||
|
(identical(other.message, message) || other.message == message) &&
|
||||||
|
(identical(other.data, data) || other.data == data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, status, message, data);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RegisterDtoImplCopyWith<_$RegisterDtoImpl> get copyWith =>
|
||||||
|
__$$RegisterDtoImplCopyWithImpl<_$RegisterDtoImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$RegisterDtoImplToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RegisterDto extends RegisterDto {
|
||||||
|
const factory _RegisterDto({
|
||||||
|
@JsonKey(name: 'status') final String? status,
|
||||||
|
@JsonKey(name: 'message') final String? message,
|
||||||
|
@JsonKey(name: 'data') final RegisterDataDto? data,
|
||||||
|
}) = _$RegisterDtoImpl;
|
||||||
|
const _RegisterDto._() : super._();
|
||||||
|
|
||||||
|
factory _RegisterDto.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$RegisterDtoImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
String? get status;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
String? get message;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
RegisterDataDto? get data;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RegisterDtoImplCopyWith<_$RegisterDtoImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterDataDto _$RegisterDataDtoFromJson(Map<String, dynamic> json) {
|
||||||
|
return _RegisterDataDto.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$RegisterDataDto {
|
||||||
|
@JsonKey(name: 'registration_token')
|
||||||
|
String? get registrationToken => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'otp_token')
|
||||||
|
String? get otpToken => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'expires_in')
|
||||||
|
int? get expiresIn => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this RegisterDataDto to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$RegisterDataDtoCopyWith<RegisterDataDto> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $RegisterDataDtoCopyWith<$Res> {
|
||||||
|
factory $RegisterDataDtoCopyWith(
|
||||||
|
RegisterDataDto value,
|
||||||
|
$Res Function(RegisterDataDto) then,
|
||||||
|
) = _$RegisterDataDtoCopyWithImpl<$Res, RegisterDataDto>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'registration_token') String? registrationToken,
|
||||||
|
@JsonKey(name: 'otp_token') String? otpToken,
|
||||||
|
@JsonKey(name: 'expires_in') int? expiresIn,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$RegisterDataDtoCopyWithImpl<$Res, $Val extends RegisterDataDto>
|
||||||
|
implements $RegisterDataDtoCopyWith<$Res> {
|
||||||
|
_$RegisterDataDtoCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? registrationToken = freezed,
|
||||||
|
Object? otpToken = freezed,
|
||||||
|
Object? expiresIn = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
registrationToken: freezed == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
otpToken: freezed == otpToken
|
||||||
|
? _value.otpToken
|
||||||
|
: otpToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
expiresIn: freezed == expiresIn
|
||||||
|
? _value.expiresIn
|
||||||
|
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RegisterDataDtoImplCopyWith<$Res>
|
||||||
|
implements $RegisterDataDtoCopyWith<$Res> {
|
||||||
|
factory _$$RegisterDataDtoImplCopyWith(
|
||||||
|
_$RegisterDataDtoImpl value,
|
||||||
|
$Res Function(_$RegisterDataDtoImpl) then,
|
||||||
|
) = __$$RegisterDataDtoImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'registration_token') String? registrationToken,
|
||||||
|
@JsonKey(name: 'otp_token') String? otpToken,
|
||||||
|
@JsonKey(name: 'expires_in') int? expiresIn,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RegisterDataDtoImplCopyWithImpl<$Res>
|
||||||
|
extends _$RegisterDataDtoCopyWithImpl<$Res, _$RegisterDataDtoImpl>
|
||||||
|
implements _$$RegisterDataDtoImplCopyWith<$Res> {
|
||||||
|
__$$RegisterDataDtoImplCopyWithImpl(
|
||||||
|
_$RegisterDataDtoImpl _value,
|
||||||
|
$Res Function(_$RegisterDataDtoImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? registrationToken = freezed,
|
||||||
|
Object? otpToken = freezed,
|
||||||
|
Object? expiresIn = freezed,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$RegisterDataDtoImpl(
|
||||||
|
registrationToken: freezed == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
otpToken: freezed == otpToken
|
||||||
|
? _value.otpToken
|
||||||
|
: otpToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
expiresIn: freezed == expiresIn
|
||||||
|
? _value.expiresIn
|
||||||
|
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$RegisterDataDtoImpl implements _RegisterDataDto {
|
||||||
|
const _$RegisterDataDtoImpl({
|
||||||
|
@JsonKey(name: 'registration_token') this.registrationToken,
|
||||||
|
@JsonKey(name: 'otp_token') this.otpToken,
|
||||||
|
@JsonKey(name: 'expires_in') this.expiresIn,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory _$RegisterDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$RegisterDataDtoImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'registration_token')
|
||||||
|
final String? registrationToken;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'otp_token')
|
||||||
|
final String? otpToken;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'expires_in')
|
||||||
|
final int? expiresIn;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RegisterDataDto(registrationToken: $registrationToken, otpToken: $otpToken, expiresIn: $expiresIn)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RegisterDataDtoImpl &&
|
||||||
|
(identical(other.registrationToken, registrationToken) ||
|
||||||
|
other.registrationToken == registrationToken) &&
|
||||||
|
(identical(other.otpToken, otpToken) ||
|
||||||
|
other.otpToken == otpToken) &&
|
||||||
|
(identical(other.expiresIn, expiresIn) ||
|
||||||
|
other.expiresIn == expiresIn));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, registrationToken, otpToken, expiresIn);
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RegisterDataDtoImplCopyWith<_$RegisterDataDtoImpl> get copyWith =>
|
||||||
|
__$$RegisterDataDtoImplCopyWithImpl<_$RegisterDataDtoImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$RegisterDataDtoImplToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RegisterDataDto implements RegisterDataDto {
|
||||||
|
const factory _RegisterDataDto({
|
||||||
|
@JsonKey(name: 'registration_token') final String? registrationToken,
|
||||||
|
@JsonKey(name: 'otp_token') final String? otpToken,
|
||||||
|
@JsonKey(name: 'expires_in') final int? expiresIn,
|
||||||
|
}) = _$RegisterDataDtoImpl;
|
||||||
|
|
||||||
|
factory _RegisterDataDto.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$RegisterDataDtoImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'registration_token')
|
||||||
|
String? get registrationToken;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'otp_token')
|
||||||
|
String? get otpToken;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'expires_in')
|
||||||
|
int? get expiresIn;
|
||||||
|
|
||||||
|
/// Create a copy of RegisterDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RegisterDataDtoImplCopyWith<_$RegisterDataDtoImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
63
lib/infrastructure/auth/auth_dtos.g.dart
Normal file
63
lib/infrastructure/auth/auth_dtos.g.dart
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'auth_dtos.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$CheckPhoneDtoImpl _$$CheckPhoneDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$CheckPhoneDtoImpl(
|
||||||
|
status: json['status'] as String?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data: json['data'] == null
|
||||||
|
? null
|
||||||
|
: CheckPhoneDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$CheckPhoneDtoImplToJson(_$CheckPhoneDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'status': instance.status,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$CheckPhoneDataDtoImpl _$$CheckPhoneDataDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$CheckPhoneDataDtoImpl(phoneNumber: json['phone_number'] as String?);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$CheckPhoneDataDtoImplToJson(
|
||||||
|
_$CheckPhoneDataDtoImpl instance,
|
||||||
|
) => <String, dynamic>{'phone_number': instance.phoneNumber};
|
||||||
|
|
||||||
|
_$RegisterDtoImpl _$$RegisterDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$RegisterDtoImpl(
|
||||||
|
status: json['status'] as String?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data: json['data'] == null
|
||||||
|
? null
|
||||||
|
: RegisterDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$RegisterDtoImplToJson(_$RegisterDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'status': instance.status,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$RegisterDataDtoImpl _$$RegisterDataDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$RegisterDataDtoImpl(
|
||||||
|
registrationToken: json['registration_token'] as String?,
|
||||||
|
otpToken: json['otp_token'] as String?,
|
||||||
|
expiresIn: (json['expires_in'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$RegisterDataDtoImplToJson(
|
||||||
|
_$RegisterDataDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'registration_token': instance.registrationToken,
|
||||||
|
'otp_token': instance.otpToken,
|
||||||
|
'expires_in': instance.expiresIn,
|
||||||
|
};
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
import 'package:data_channel/data_channel.dart';
|
||||||
|
|
||||||
|
import '../../../common/api/api_client.dart';
|
||||||
|
import '../../../common/api/api_failure.dart';
|
||||||
|
import '../../../common/extension/extension.dart';
|
||||||
|
import '../../../common/url/api_path.dart';
|
||||||
|
import '../../../domain/auth/auth.dart';
|
||||||
|
import '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class AuthRemoteDataProvider {
|
||||||
|
final ApiClient _apiClient;
|
||||||
|
final String _logName = "AuthRemoteDataProvider";
|
||||||
|
|
||||||
|
AuthRemoteDataProvider(this._apiClient);
|
||||||
|
|
||||||
|
Future<DC<AuthFailure, CheckPhoneDto>> checkPhone({
|
||||||
|
required String phoneNumber,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.post(
|
||||||
|
ApiPath.checkPhone,
|
||||||
|
data: {'phone_number': phoneNumber},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['code'] == 401) {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.serverError(
|
||||||
|
ApiFailure.unauthorized('Incorrect email or password'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.data['success'] == false) {
|
||||||
|
if ((response.data['errors'] as List).isNotEmpty) {
|
||||||
|
if (response.data['errors'][0]['code'] == 303) {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage('No. Telepon Tidak Boleh Kosong'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = CheckPhoneDto.fromJson(response.data['data']);
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('checkPhone', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AuthFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AuthFailure, RegisterDto>> register({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String name,
|
||||||
|
required DateTime birthDate,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.post(
|
||||||
|
ApiPath.register,
|
||||||
|
data: {
|
||||||
|
'phone_number': phoneNumber,
|
||||||
|
'name': name,
|
||||||
|
'birth_date': birthDate.toServerDate,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['success'] == false) {
|
||||||
|
if ((response.data['errors'] as List).isNotEmpty) {
|
||||||
|
if (response.data['errors'][0]['code'] == "900") {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage('No. Telepon Sudah Terdaftar'),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = RegisterDto.fromJson(response.data['data']);
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('register', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AuthFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
lib/infrastructure/auth/dto/check_phone_dto.dart
Normal file
30
lib/infrastructure/auth/dto/check_phone_dto.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
part of '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CheckPhoneDto with _$CheckPhoneDto {
|
||||||
|
const CheckPhoneDto._();
|
||||||
|
|
||||||
|
const factory CheckPhoneDto({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') CheckPhoneDataDto? data,
|
||||||
|
}) = _CheckPhoneDto;
|
||||||
|
|
||||||
|
factory CheckPhoneDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$CheckPhoneDtoFromJson(json);
|
||||||
|
CheckPhone toDomain() => CheckPhone(
|
||||||
|
status: status ?? '',
|
||||||
|
message: message ?? '',
|
||||||
|
phoneNumber: data?.phoneNumber ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CheckPhoneDataDto with _$CheckPhoneDataDto {
|
||||||
|
const factory CheckPhoneDataDto({
|
||||||
|
@JsonKey(name: 'phone_number') String? phoneNumber,
|
||||||
|
}) = _CheckPhoneDataDto;
|
||||||
|
|
||||||
|
factory CheckPhoneDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$CheckPhoneDataDtoFromJson(json);
|
||||||
|
}
|
||||||
36
lib/infrastructure/auth/dto/register_dto.dart
Normal file
36
lib/infrastructure/auth/dto/register_dto.dart
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
part of '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class RegisterDto with _$RegisterDto {
|
||||||
|
const RegisterDto._();
|
||||||
|
|
||||||
|
const factory RegisterDto({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') RegisterDataDto? data,
|
||||||
|
}) = _RegisterDto;
|
||||||
|
|
||||||
|
factory RegisterDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$RegisterDtoFromJson(json);
|
||||||
|
|
||||||
|
/// mapping ke domain
|
||||||
|
Register toDomain() => Register(
|
||||||
|
status: status ?? '',
|
||||||
|
message: message ?? '',
|
||||||
|
registrationToken: data?.registrationToken ?? '',
|
||||||
|
otpToken: data?.otpToken ?? '',
|
||||||
|
expiresIn: data?.expiresIn ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class RegisterDataDto with _$RegisterDataDto {
|
||||||
|
const factory RegisterDataDto({
|
||||||
|
@JsonKey(name: 'registration_token') String? registrationToken,
|
||||||
|
@JsonKey(name: 'otp_token') String? otpToken,
|
||||||
|
@JsonKey(name: 'expires_in') int? expiresIn,
|
||||||
|
}) = _RegisterDataDto;
|
||||||
|
|
||||||
|
factory RegisterDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$RegisterDataDtoFromJson(json);
|
||||||
|
}
|
||||||
64
lib/infrastructure/auth/repositories/auth_repository.dart
Normal file
64
lib/infrastructure/auth/repositories/auth_repository.dart
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/auth/auth.dart';
|
||||||
|
import '../datasources/remote_data_provider.dart';
|
||||||
|
|
||||||
|
@Injectable(as: IAuthRepository)
|
||||||
|
class AuthRepository implements IAuthRepository {
|
||||||
|
final AuthRemoteDataProvider _remoteDataProvider;
|
||||||
|
|
||||||
|
final String _logName = 'AuthRepository';
|
||||||
|
|
||||||
|
AuthRepository(this._remoteDataProvider);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, CheckPhone>> checkPhone({
|
||||||
|
required String phoneNumber,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final result = await _remoteDataProvider.checkPhone(
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.hasError) {
|
||||||
|
return left(result.error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
final auth = result.data!.toDomain();
|
||||||
|
|
||||||
|
return right(auth);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('checkPhoneError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, Register>> register({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String name,
|
||||||
|
required DateTime birthDate,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final result = await _remoteDataProvider.register(
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
name: name,
|
||||||
|
birthDate: birthDate,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.hasError) {
|
||||||
|
return left(result.error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
final auth = result.data!.toDomain();
|
||||||
|
|
||||||
|
return right(auth);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('checkPhoneError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,13 +11,22 @@
|
|||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart' as _i895;
|
import 'package:connectivity_plus/connectivity_plus.dart' as _i895;
|
||||||
import 'package:dio/dio.dart' as _i361;
|
import 'package:dio/dio.dart' as _i361;
|
||||||
|
import 'package:enaklo/application/auth/check_phone_form/check_phone_form_bloc.dart'
|
||||||
|
as _i869;
|
||||||
|
import 'package:enaklo/application/auth/register_form/register_form_bloc.dart'
|
||||||
|
as _i260;
|
||||||
import 'package:enaklo/common/api/api_client.dart' as _i842;
|
import 'package:enaklo/common/api/api_client.dart' as _i842;
|
||||||
import 'package:enaklo/common/di/di_auto_route.dart' as _i619;
|
import 'package:enaklo/common/di/di_auto_route.dart' as _i619;
|
||||||
import 'package:enaklo/common/di/di_connectivity.dart' as _i644;
|
import 'package:enaklo/common/di/di_connectivity.dart' as _i644;
|
||||||
import 'package:enaklo/common/di/di_dio.dart' as _i842;
|
import 'package:enaklo/common/di/di_dio.dart' as _i842;
|
||||||
import 'package:enaklo/common/di/di_shared_preferences.dart' as _i672;
|
import 'package:enaklo/common/di/di_shared_preferences.dart' as _i672;
|
||||||
import 'package:enaklo/common/network/network_client.dart' as _i109;
|
import 'package:enaklo/common/network/network_client.dart' as _i109;
|
||||||
|
import 'package:enaklo/domain/auth/auth.dart' as _i995;
|
||||||
import 'package:enaklo/env.dart' as _i372;
|
import 'package:enaklo/env.dart' as _i372;
|
||||||
|
import 'package:enaklo/infrastructure/auth/datasources/remote_data_provider.dart'
|
||||||
|
as _i818;
|
||||||
|
import 'package:enaklo/infrastructure/auth/repositories/auth_repository.dart'
|
||||||
|
as _i879;
|
||||||
import 'package:enaklo/presentation/router/app_router.dart' as _i698;
|
import 'package:enaklo/presentation/router/app_router.dart' as _i698;
|
||||||
import 'package:get_it/get_it.dart' as _i174;
|
import 'package:get_it/get_it.dart' as _i174;
|
||||||
import 'package:injectable/injectable.dart' as _i526;
|
import 'package:injectable/injectable.dart' as _i526;
|
||||||
@ -52,6 +61,18 @@ extension GetItInjectableX on _i174.GetIt {
|
|||||||
gh.lazySingleton<_i842.ApiClient>(
|
gh.lazySingleton<_i842.ApiClient>(
|
||||||
() => _i842.ApiClient(gh<_i361.Dio>(), gh<_i372.Env>()),
|
() => _i842.ApiClient(gh<_i361.Dio>(), gh<_i372.Env>()),
|
||||||
);
|
);
|
||||||
|
gh.factory<_i818.AuthRemoteDataProvider>(
|
||||||
|
() => _i818.AuthRemoteDataProvider(gh<_i842.ApiClient>()),
|
||||||
|
);
|
||||||
|
gh.factory<_i995.IAuthRepository>(
|
||||||
|
() => _i879.AuthRepository(gh<_i818.AuthRemoteDataProvider>()),
|
||||||
|
);
|
||||||
|
gh.factory<_i869.CheckPhoneFormBloc>(
|
||||||
|
() => _i869.CheckPhoneFormBloc(gh<_i995.IAuthRepository>()),
|
||||||
|
);
|
||||||
|
gh.factory<_i260.RegisterFormBloc>(
|
||||||
|
() => _i260.RegisterFormBloc(gh<_i995.IAuthRepository>()),
|
||||||
|
);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
pubspec.lock
32
pubspec.lock
@ -121,6 +121,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
bloc:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: bloc
|
||||||
|
sha256: "52c10575f4445c61dd9e0cafcc6356fdd827c4c64dd7945ef3c4105f6b6ac189"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "9.0.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -422,6 +430,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_bloc:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_bloc
|
||||||
|
sha256: cf51747952201a455a1c840f8171d273be009b932c75093020f9af64f2123e38
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "9.1.1"
|
||||||
flutter_cache_manager:
|
flutter_cache_manager:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -704,6 +720,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
|
nested:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: nested
|
||||||
|
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
nm:
|
nm:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -832,6 +856,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.3"
|
version: "6.0.3"
|
||||||
|
provider:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: provider
|
||||||
|
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.5+1"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -32,6 +32,8 @@ dependencies:
|
|||||||
cached_network_image: ^3.4.1
|
cached_network_image: ^3.4.1
|
||||||
shimmer: ^3.0.0
|
shimmer: ^3.0.0
|
||||||
audioplayers: ^6.5.1
|
audioplayers: ^6.5.1
|
||||||
|
flutter_bloc: ^9.1.1
|
||||||
|
bloc: ^9.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user