Compare commits
48
Commits
f70b43c6ab
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7887704a5c | ||
|
|
4c12244d3c | ||
|
|
f4f775b9ed | ||
|
|
44d48d41d4 | ||
|
|
82e1f93cce | ||
|
|
1ce980a87b | ||
|
|
909c312af0 | ||
|
|
73918430b2 | ||
|
|
a5d66c63b7 | ||
|
|
3c596461c6 | ||
|
|
006486bc2a | ||
|
|
2e00207343 | ||
|
|
8e35582f93 | ||
|
|
0ea1a6fa56 | ||
|
|
cee78e179b | ||
|
|
1ca1a45126 | ||
|
|
214dfe3262 | ||
|
|
3b26b19b25 | ||
|
|
b20854f329 | ||
|
|
1a0c0cf49b | ||
|
|
c40f96fc88 | ||
|
|
13c55afe3c | ||
|
|
99bf4d5c7f | ||
|
|
207dda29df | ||
|
|
c3263edb89 | ||
|
|
c072e4c168 | ||
|
|
e4af5f10d7 | ||
|
|
37b22fe662 | ||
|
|
c12e9bd188 | ||
|
|
dc4fdf5fbf | ||
|
|
0d1e516686 | ||
|
|
4d994e303b | ||
|
|
b0cf40136b | ||
|
|
89c94c796a | ||
|
|
06cc7e3781 | ||
|
|
88c3cebd31 | ||
|
|
c13e3c598e | ||
|
|
936875c30a | ||
|
|
0afb683045 | ||
|
|
c790d00341 | ||
|
|
00c9d8435a | ||
|
|
079813e95b | ||
|
|
30a2bece41 | ||
|
|
2d596a25b9 | ||
|
|
dcf76b5fed | ||
|
|
4dc56662c8 | ||
|
|
74d706b32a | ||
|
|
5f0284a9e5 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 332 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 367 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
@@ -0,0 +1,49 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../domain/auth/auth.dart';
|
||||||
|
|
||||||
|
part 'auth_event.dart';
|
||||||
|
part 'auth_state.dart';
|
||||||
|
part 'auth_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
AuthBloc(this._repository) : super(AuthState.initial()) {
|
||||||
|
on<AuthEvent>(_onAuthEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onAuthEvent(AuthEvent event, Emitter<AuthState> emit) {
|
||||||
|
return event.map(
|
||||||
|
fetchCurrentUser: (e) async {
|
||||||
|
emit(state.copyWith(failureOption: none()));
|
||||||
|
|
||||||
|
final token = await _repository.hasToken();
|
||||||
|
|
||||||
|
final failureOrAuth = await _repository.currentUser();
|
||||||
|
|
||||||
|
failureOrAuth.fold(
|
||||||
|
(f) => emit(
|
||||||
|
state.copyWith(
|
||||||
|
failureOption: optionOf(f),
|
||||||
|
status: token
|
||||||
|
? AuthStatus.authenticated()
|
||||||
|
: AuthStatus.unauthenticated(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(user) => emit(
|
||||||
|
state.copyWith(
|
||||||
|
user: user,
|
||||||
|
status: token
|
||||||
|
? AuthStatus.authenticated()
|
||||||
|
: AuthStatus.unauthenticated(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,806 @@
|
|||||||
|
// 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_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 _$AuthEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() fetchCurrentUser,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? fetchCurrentUser,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? fetchCurrentUser,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_FetchCurrentUser value) fetchCurrentUser,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $AuthEventCopyWith<$Res> {
|
||||||
|
factory $AuthEventCopyWith(AuthEvent value, $Res Function(AuthEvent) then) =
|
||||||
|
_$AuthEventCopyWithImpl<$Res, AuthEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$AuthEventCopyWithImpl<$Res, $Val extends AuthEvent>
|
||||||
|
implements $AuthEventCopyWith<$Res> {
|
||||||
|
_$AuthEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AuthEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FetchCurrentUserImplCopyWith<$Res> {
|
||||||
|
factory _$$FetchCurrentUserImplCopyWith(
|
||||||
|
_$FetchCurrentUserImpl value,
|
||||||
|
$Res Function(_$FetchCurrentUserImpl) then,
|
||||||
|
) = __$$FetchCurrentUserImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FetchCurrentUserImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthEventCopyWithImpl<$Res, _$FetchCurrentUserImpl>
|
||||||
|
implements _$$FetchCurrentUserImplCopyWith<$Res> {
|
||||||
|
__$$FetchCurrentUserImplCopyWithImpl(
|
||||||
|
_$FetchCurrentUserImpl _value,
|
||||||
|
$Res Function(_$FetchCurrentUserImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FetchCurrentUserImpl implements _FetchCurrentUser {
|
||||||
|
const _$FetchCurrentUserImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthEvent.fetchCurrentUser()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$FetchCurrentUserImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() fetchCurrentUser,
|
||||||
|
}) {
|
||||||
|
return fetchCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? fetchCurrentUser,
|
||||||
|
}) {
|
||||||
|
return fetchCurrentUser?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? fetchCurrentUser,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetchCurrentUser != null) {
|
||||||
|
return fetchCurrentUser();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_FetchCurrentUser value) fetchCurrentUser,
|
||||||
|
}) {
|
||||||
|
return fetchCurrentUser(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||||
|
}) {
|
||||||
|
return fetchCurrentUser?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetchCurrentUser != null) {
|
||||||
|
return fetchCurrentUser(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _FetchCurrentUser implements AuthEvent {
|
||||||
|
const factory _FetchCurrentUser() = _$FetchCurrentUserImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$AuthState {
|
||||||
|
User get user => throw _privateConstructorUsedError;
|
||||||
|
AuthStatus get status => throw _privateConstructorUsedError;
|
||||||
|
Option<AuthFailure> get failureOption => throw _privateConstructorUsedError;
|
||||||
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$AuthStateCopyWith<AuthState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $AuthStateCopyWith<$Res> {
|
||||||
|
factory $AuthStateCopyWith(AuthState value, $Res Function(AuthState) then) =
|
||||||
|
_$AuthStateCopyWithImpl<$Res, AuthState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
User user,
|
||||||
|
AuthStatus status,
|
||||||
|
Option<AuthFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
});
|
||||||
|
|
||||||
|
$UserCopyWith<$Res> get user;
|
||||||
|
$AuthStatusCopyWith<$Res> get status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState>
|
||||||
|
implements $AuthStateCopyWith<$Res> {
|
||||||
|
_$AuthStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? user = null,
|
||||||
|
Object? status = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
user: null == user
|
||||||
|
? _value.user
|
||||||
|
: user // ignore: cast_nullable_to_non_nullable
|
||||||
|
as User,
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as AuthStatus,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AuthFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$UserCopyWith<$Res> get user {
|
||||||
|
return $UserCopyWith<$Res>(_value.user, (value) {
|
||||||
|
return _then(_value.copyWith(user: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$AuthStatusCopyWith<$Res> get status {
|
||||||
|
return $AuthStatusCopyWith<$Res>(_value.status, (value) {
|
||||||
|
return _then(_value.copyWith(status: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$AuthStateImplCopyWith<$Res>
|
||||||
|
implements $AuthStateCopyWith<$Res> {
|
||||||
|
factory _$$AuthStateImplCopyWith(
|
||||||
|
_$AuthStateImpl value,
|
||||||
|
$Res Function(_$AuthStateImpl) then,
|
||||||
|
) = __$$AuthStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
User user,
|
||||||
|
AuthStatus status,
|
||||||
|
Option<AuthFailure> failureOption,
|
||||||
|
bool isFetching,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$UserCopyWith<$Res> get user;
|
||||||
|
@override
|
||||||
|
$AuthStatusCopyWith<$Res> get status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$AuthStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthStateCopyWithImpl<$Res, _$AuthStateImpl>
|
||||||
|
implements _$$AuthStateImplCopyWith<$Res> {
|
||||||
|
__$$AuthStateImplCopyWithImpl(
|
||||||
|
_$AuthStateImpl _value,
|
||||||
|
$Res Function(_$AuthStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? user = null,
|
||||||
|
Object? status = null,
|
||||||
|
Object? failureOption = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$AuthStateImpl(
|
||||||
|
user: null == user
|
||||||
|
? _value.user
|
||||||
|
: user // ignore: cast_nullable_to_non_nullable
|
||||||
|
as User,
|
||||||
|
status: null == status
|
||||||
|
? _value.status
|
||||||
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as AuthStatus,
|
||||||
|
failureOption: null == failureOption
|
||||||
|
? _value.failureOption
|
||||||
|
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<AuthFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$AuthStateImpl extends _AuthState {
|
||||||
|
const _$AuthStateImpl({
|
||||||
|
required this.user,
|
||||||
|
this.status = const AuthStatus.initial(),
|
||||||
|
required this.failureOption,
|
||||||
|
this.isFetching = false,
|
||||||
|
}) : super._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
final User user;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final AuthStatus status;
|
||||||
|
@override
|
||||||
|
final Option<AuthFailure> failureOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isFetching;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthState(user: $user, status: $status, failureOption: $failureOption, isFetching: $isFetching)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$AuthStateImpl &&
|
||||||
|
(identical(other.user, user) || other.user == user) &&
|
||||||
|
(identical(other.status, status) || other.status == status) &&
|
||||||
|
(identical(other.failureOption, failureOption) ||
|
||||||
|
other.failureOption == failureOption) &&
|
||||||
|
(identical(other.isFetching, isFetching) ||
|
||||||
|
other.isFetching == isFetching));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, user, status, failureOption, isFetching);
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$AuthStateImplCopyWith<_$AuthStateImpl> get copyWith =>
|
||||||
|
__$$AuthStateImplCopyWithImpl<_$AuthStateImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _AuthState extends AuthState {
|
||||||
|
const factory _AuthState({
|
||||||
|
required final User user,
|
||||||
|
final AuthStatus status,
|
||||||
|
required final Option<AuthFailure> failureOption,
|
||||||
|
final bool isFetching,
|
||||||
|
}) = _$AuthStateImpl;
|
||||||
|
const _AuthState._() : super._();
|
||||||
|
|
||||||
|
@override
|
||||||
|
User get user;
|
||||||
|
@override
|
||||||
|
AuthStatus get status;
|
||||||
|
@override
|
||||||
|
Option<AuthFailure> get failureOption;
|
||||||
|
@override
|
||||||
|
bool get isFetching;
|
||||||
|
|
||||||
|
/// Create a copy of AuthState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$AuthStateImplCopyWith<_$AuthStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$AuthStatus {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() authenticated,
|
||||||
|
required TResult Function() unauthenticated,
|
||||||
|
required TResult Function() initial,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? authenticated,
|
||||||
|
TResult? Function()? unauthenticated,
|
||||||
|
TResult? Function()? initial,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? authenticated,
|
||||||
|
TResult Function()? unauthenticated,
|
||||||
|
TResult Function()? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Authenticated value) authenticated,
|
||||||
|
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||||
|
required TResult Function(_Initial value) initial,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Authenticated value)? authenticated,
|
||||||
|
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult? Function(_Initial value)? initial,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Authenticated value)? authenticated,
|
||||||
|
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult Function(_Initial value)? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $AuthStatusCopyWith<$Res> {
|
||||||
|
factory $AuthStatusCopyWith(
|
||||||
|
AuthStatus value,
|
||||||
|
$Res Function(AuthStatus) then,
|
||||||
|
) = _$AuthStatusCopyWithImpl<$Res, AuthStatus>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$AuthStatusCopyWithImpl<$Res, $Val extends AuthStatus>
|
||||||
|
implements $AuthStatusCopyWith<$Res> {
|
||||||
|
_$AuthStatusCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AuthStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$AuthenticatedImplCopyWith<$Res> {
|
||||||
|
factory _$$AuthenticatedImplCopyWith(
|
||||||
|
_$AuthenticatedImpl value,
|
||||||
|
$Res Function(_$AuthenticatedImpl) then,
|
||||||
|
) = __$$AuthenticatedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$AuthenticatedImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthStatusCopyWithImpl<$Res, _$AuthenticatedImpl>
|
||||||
|
implements _$$AuthenticatedImplCopyWith<$Res> {
|
||||||
|
__$$AuthenticatedImplCopyWithImpl(
|
||||||
|
_$AuthenticatedImpl _value,
|
||||||
|
$Res Function(_$AuthenticatedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$AuthenticatedImpl implements _Authenticated {
|
||||||
|
const _$AuthenticatedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthStatus.authenticated()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$AuthenticatedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() authenticated,
|
||||||
|
required TResult Function() unauthenticated,
|
||||||
|
required TResult Function() initial,
|
||||||
|
}) {
|
||||||
|
return authenticated();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? authenticated,
|
||||||
|
TResult? Function()? unauthenticated,
|
||||||
|
TResult? Function()? initial,
|
||||||
|
}) {
|
||||||
|
return authenticated?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? authenticated,
|
||||||
|
TResult Function()? unauthenticated,
|
||||||
|
TResult Function()? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (authenticated != null) {
|
||||||
|
return authenticated();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Authenticated value) authenticated,
|
||||||
|
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||||
|
required TResult Function(_Initial value) initial,
|
||||||
|
}) {
|
||||||
|
return authenticated(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Authenticated value)? authenticated,
|
||||||
|
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult? Function(_Initial value)? initial,
|
||||||
|
}) {
|
||||||
|
return authenticated?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Authenticated value)? authenticated,
|
||||||
|
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult Function(_Initial value)? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (authenticated != null) {
|
||||||
|
return authenticated(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Authenticated implements AuthStatus {
|
||||||
|
const factory _Authenticated() = _$AuthenticatedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$UnauthenticatedImplCopyWith<$Res> {
|
||||||
|
factory _$$UnauthenticatedImplCopyWith(
|
||||||
|
_$UnauthenticatedImpl value,
|
||||||
|
$Res Function(_$UnauthenticatedImpl) then,
|
||||||
|
) = __$$UnauthenticatedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$UnauthenticatedImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthStatusCopyWithImpl<$Res, _$UnauthenticatedImpl>
|
||||||
|
implements _$$UnauthenticatedImplCopyWith<$Res> {
|
||||||
|
__$$UnauthenticatedImplCopyWithImpl(
|
||||||
|
_$UnauthenticatedImpl _value,
|
||||||
|
$Res Function(_$UnauthenticatedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$UnauthenticatedImpl implements _Unauthenticated {
|
||||||
|
const _$UnauthenticatedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthStatus.unauthenticated()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$UnauthenticatedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() authenticated,
|
||||||
|
required TResult Function() unauthenticated,
|
||||||
|
required TResult Function() initial,
|
||||||
|
}) {
|
||||||
|
return unauthenticated();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? authenticated,
|
||||||
|
TResult? Function()? unauthenticated,
|
||||||
|
TResult? Function()? initial,
|
||||||
|
}) {
|
||||||
|
return unauthenticated?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? authenticated,
|
||||||
|
TResult Function()? unauthenticated,
|
||||||
|
TResult Function()? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (unauthenticated != null) {
|
||||||
|
return unauthenticated();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Authenticated value) authenticated,
|
||||||
|
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||||
|
required TResult Function(_Initial value) initial,
|
||||||
|
}) {
|
||||||
|
return unauthenticated(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Authenticated value)? authenticated,
|
||||||
|
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult? Function(_Initial value)? initial,
|
||||||
|
}) {
|
||||||
|
return unauthenticated?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Authenticated value)? authenticated,
|
||||||
|
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult Function(_Initial value)? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (unauthenticated != null) {
|
||||||
|
return unauthenticated(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Unauthenticated implements AuthStatus {
|
||||||
|
const factory _Unauthenticated() = _$UnauthenticatedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$InitialImplCopyWith<$Res> {
|
||||||
|
factory _$$InitialImplCopyWith(
|
||||||
|
_$InitialImpl value,
|
||||||
|
$Res Function(_$InitialImpl) then,
|
||||||
|
) = __$$InitialImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$InitialImplCopyWithImpl<$Res>
|
||||||
|
extends _$AuthStatusCopyWithImpl<$Res, _$InitialImpl>
|
||||||
|
implements _$$InitialImplCopyWith<$Res> {
|
||||||
|
__$$InitialImplCopyWithImpl(
|
||||||
|
_$InitialImpl _value,
|
||||||
|
$Res Function(_$InitialImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of AuthStatus
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$InitialImpl implements _Initial {
|
||||||
|
const _$InitialImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AuthStatus.initial()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() authenticated,
|
||||||
|
required TResult Function() unauthenticated,
|
||||||
|
required TResult Function() initial,
|
||||||
|
}) {
|
||||||
|
return initial();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? authenticated,
|
||||||
|
TResult? Function()? unauthenticated,
|
||||||
|
TResult? Function()? initial,
|
||||||
|
}) {
|
||||||
|
return initial?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? authenticated,
|
||||||
|
TResult Function()? unauthenticated,
|
||||||
|
TResult Function()? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (initial != null) {
|
||||||
|
return initial();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Authenticated value) authenticated,
|
||||||
|
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||||
|
required TResult Function(_Initial value) initial,
|
||||||
|
}) {
|
||||||
|
return initial(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Authenticated value)? authenticated,
|
||||||
|
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult? Function(_Initial value)? initial,
|
||||||
|
}) {
|
||||||
|
return initial?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Authenticated value)? authenticated,
|
||||||
|
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||||
|
TResult Function(_Initial value)? initial,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (initial != null) {
|
||||||
|
return initial(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Initial implements AuthStatus {
|
||||||
|
const factory _Initial() = _$InitialImpl;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
part of 'auth_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class AuthEvent with _$AuthEvent {
|
||||||
|
const factory AuthEvent.fetchCurrentUser() = _FetchCurrentUser;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
part of 'auth_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class AuthState with _$AuthState {
|
||||||
|
const AuthState._();
|
||||||
|
|
||||||
|
const factory AuthState({
|
||||||
|
required User user,
|
||||||
|
@Default(AuthStatus.initial()) AuthStatus status,
|
||||||
|
required Option<AuthFailure> failureOption,
|
||||||
|
@Default(false) bool isFetching,
|
||||||
|
}) = _AuthState;
|
||||||
|
|
||||||
|
factory AuthState.initial() =>
|
||||||
|
AuthState(user: User.empty(), failureOption: none());
|
||||||
|
|
||||||
|
bool get isAuthenticated => status == const AuthStatus.authenticated();
|
||||||
|
bool get isInitial => status == const AuthStatus.initial();
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class AuthStatus with _$AuthStatus {
|
||||||
|
const factory AuthStatus.authenticated() = _Authenticated;
|
||||||
|
const factory AuthStatus.unauthenticated() = _Unauthenticated;
|
||||||
|
const factory AuthStatus.initial() = _Initial;
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../common/function/app_function.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: getNormalizePhone(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());
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
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 'login_form_event.dart';
|
||||||
|
part 'login_form_state.dart';
|
||||||
|
part 'login_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class LoginFormBloc extends Bloc<LoginFormEvent, LoginFormState> {
|
||||||
|
final IAuthRepository _authRepository;
|
||||||
|
LoginFormBloc(this._authRepository) : super(LoginFormState.initial()) {
|
||||||
|
on<LoginFormEvent>(_onLoginFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onLoginFormEvent(
|
||||||
|
LoginFormEvent event,
|
||||||
|
Emitter<LoginFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
phoneNumberChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
phoneNumber: e.phoneNumber,
|
||||||
|
failureOrLoginOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
passwordChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(password: e.password, failureOrLoginOption: none()),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
submitted: (e) async {
|
||||||
|
Either<AuthFailure, Login>? failureOrLogin;
|
||||||
|
emit(state.copyWith(isSubmitting: true, failureOrLoginOption: none()));
|
||||||
|
|
||||||
|
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||||
|
final passwordValid = state.password.isNotEmpty;
|
||||||
|
|
||||||
|
log(
|
||||||
|
'phoneNumberValid: $phoneNumberValid, passwordValid: $passwordValid, phoneNumber: ${state.phoneNumber}, password: ${state.password}',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (phoneNumberValid && passwordValid) {
|
||||||
|
failureOrLogin = await _authRepository.login(
|
||||||
|
phoneNumber: state.phoneNumber,
|
||||||
|
password: state.password,
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrLoginOption: optionOf(failureOrLogin),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,740 @@
|
|||||||
|
// 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 'login_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 _$LoginFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $LoginFormEventCopyWith<$Res> {
|
||||||
|
factory $LoginFormEventCopyWith(
|
||||||
|
LoginFormEvent value,
|
||||||
|
$Res Function(LoginFormEvent) then,
|
||||||
|
) = _$LoginFormEventCopyWithImpl<$Res, LoginFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$LoginFormEventCopyWithImpl<$Res, $Val extends LoginFormEvent>
|
||||||
|
implements $LoginFormEventCopyWith<$Res> {
|
||||||
|
_$LoginFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// 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 _$LoginFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||||
|
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||||
|
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||||
|
_$PhoneNumberChangedImpl _value,
|
||||||
|
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// 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 'LoginFormEvent.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 LoginFormEvent
|
||||||
|
/// 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 password) passwordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
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(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (phoneNumberChanged != null) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PhoneNumberChanged implements LoginFormEvent {
|
||||||
|
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||||
|
_$PhoneNumberChangedImpl;
|
||||||
|
|
||||||
|
String get phoneNumber;
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// 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 _$$PasswordChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$PasswordChangedImplCopyWith(
|
||||||
|
_$PasswordChangedImpl value,
|
||||||
|
$Res Function(_$PasswordChangedImpl) then,
|
||||||
|
) = __$$PasswordChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String password});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$PasswordChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$LoginFormEventCopyWithImpl<$Res, _$PasswordChangedImpl>
|
||||||
|
implements _$$PasswordChangedImplCopyWith<$Res> {
|
||||||
|
__$$PasswordChangedImplCopyWithImpl(
|
||||||
|
_$PasswordChangedImpl _value,
|
||||||
|
$Res Function(_$PasswordChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? password = null}) {
|
||||||
|
return _then(
|
||||||
|
_$PasswordChangedImpl(
|
||||||
|
null == password
|
||||||
|
? _value.password
|
||||||
|
: password // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$PasswordChangedImpl implements _PasswordChanged {
|
||||||
|
const _$PasswordChangedImpl(this.password);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String password;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'LoginFormEvent.passwordChanged(password: $password)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$PasswordChangedImpl &&
|
||||||
|
(identical(other.password, password) ||
|
||||||
|
other.password == password));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, password);
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||||
|
__$$PasswordChangedImplCopyWithImpl<_$PasswordChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged?.call(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (passwordChanged != null) {
|
||||||
|
return passwordChanged(password);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (passwordChanged != null) {
|
||||||
|
return passwordChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PasswordChanged implements LoginFormEvent {
|
||||||
|
const factory _PasswordChanged(final String password) = _$PasswordChangedImpl;
|
||||||
|
|
||||||
|
String get password;
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$LoginFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'LoginFormEvent.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 password) passwordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
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(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements LoginFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$LoginFormState {
|
||||||
|
String get phoneNumber => throw _privateConstructorUsedError;
|
||||||
|
String get password => throw _privateConstructorUsedError;
|
||||||
|
Option<Either<AuthFailure, Login>> get failureOrLoginOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$LoginFormStateCopyWith<LoginFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $LoginFormStateCopyWith<$Res> {
|
||||||
|
factory $LoginFormStateCopyWith(
|
||||||
|
LoginFormState value,
|
||||||
|
$Res Function(LoginFormState) then,
|
||||||
|
) = _$LoginFormStateCopyWithImpl<$Res, LoginFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
String password,
|
||||||
|
Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$LoginFormStateCopyWithImpl<$Res, $Val extends LoginFormState>
|
||||||
|
implements $LoginFormStateCopyWith<$Res> {
|
||||||
|
_$LoginFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? password = null,
|
||||||
|
Object? failureOrLoginOption = 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,
|
||||||
|
password: null == password
|
||||||
|
? _value.password
|
||||||
|
: password // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrLoginOption: null == failureOrLoginOption
|
||||||
|
? _value.failureOrLoginOption
|
||||||
|
: failureOrLoginOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Login>>,
|
||||||
|
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 _$$LoginFormStateImplCopyWith<$Res>
|
||||||
|
implements $LoginFormStateCopyWith<$Res> {
|
||||||
|
factory _$$LoginFormStateImplCopyWith(
|
||||||
|
_$LoginFormStateImpl value,
|
||||||
|
$Res Function(_$LoginFormStateImpl) then,
|
||||||
|
) = __$$LoginFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
String password,
|
||||||
|
Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$LoginFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$LoginFormStateCopyWithImpl<$Res, _$LoginFormStateImpl>
|
||||||
|
implements _$$LoginFormStateImplCopyWith<$Res> {
|
||||||
|
__$$LoginFormStateImplCopyWithImpl(
|
||||||
|
_$LoginFormStateImpl _value,
|
||||||
|
$Res Function(_$LoginFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? password = null,
|
||||||
|
Object? failureOrLoginOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$LoginFormStateImpl(
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
password: null == password
|
||||||
|
? _value.password
|
||||||
|
: password // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrLoginOption: null == failureOrLoginOption
|
||||||
|
? _value.failureOrLoginOption
|
||||||
|
: failureOrLoginOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Login>>,
|
||||||
|
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 _$LoginFormStateImpl implements _LoginFormState {
|
||||||
|
const _$LoginFormStateImpl({
|
||||||
|
required this.phoneNumber,
|
||||||
|
required this.password,
|
||||||
|
required this.failureOrLoginOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
this.showErrorMessages = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
@override
|
||||||
|
final String password;
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, Login>> failureOrLoginOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool showErrorMessages;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'LoginFormState(phoneNumber: $phoneNumber, password: $password, failureOrLoginOption: $failureOrLoginOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$LoginFormStateImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber) &&
|
||||||
|
(identical(other.password, password) ||
|
||||||
|
other.password == password) &&
|
||||||
|
(identical(other.failureOrLoginOption, failureOrLoginOption) ||
|
||||||
|
other.failureOrLoginOption == failureOrLoginOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting) &&
|
||||||
|
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||||
|
other.showErrorMessages == showErrorMessages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
phoneNumber,
|
||||||
|
password,
|
||||||
|
failureOrLoginOption,
|
||||||
|
isSubmitting,
|
||||||
|
showErrorMessages,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$LoginFormStateImplCopyWith<_$LoginFormStateImpl> get copyWith =>
|
||||||
|
__$$LoginFormStateImplCopyWithImpl<_$LoginFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _LoginFormState implements LoginFormState {
|
||||||
|
const factory _LoginFormState({
|
||||||
|
required final String phoneNumber,
|
||||||
|
required final String password,
|
||||||
|
required final Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
final bool showErrorMessages,
|
||||||
|
}) = _$LoginFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get phoneNumber;
|
||||||
|
@override
|
||||||
|
String get password;
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, Login>> get failureOrLoginOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
@override
|
||||||
|
bool get showErrorMessages;
|
||||||
|
|
||||||
|
/// Create a copy of LoginFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$LoginFormStateImplCopyWith<_$LoginFormStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
part of 'login_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class LoginFormEvent with _$LoginFormEvent {
|
||||||
|
const factory LoginFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||||
|
_PhoneNumberChanged;
|
||||||
|
const factory LoginFormEvent.passwordChanged(String password) =
|
||||||
|
_PasswordChanged;
|
||||||
|
const factory LoginFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
part of 'login_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class LoginFormState with _$LoginFormState {
|
||||||
|
const factory LoginFormState({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String password,
|
||||||
|
required Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
@Default(false) bool showErrorMessages,
|
||||||
|
}) = _LoginFormState;
|
||||||
|
|
||||||
|
factory LoginFormState.initial() => LoginFormState(
|
||||||
|
phoneNumber: '',
|
||||||
|
password: '',
|
||||||
|
failureOrLoginOption: none(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 'logout_form_event.dart';
|
||||||
|
part 'logout_form_state.dart';
|
||||||
|
part 'logout_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class LogoutFormBloc extends Bloc<LogoutFormEvent, LogoutFormState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
|
||||||
|
LogoutFormBloc(this._repository) : super(LogoutFormState.initial()) {
|
||||||
|
on<LogoutFormEvent>(_onLogoutFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onLogoutFormEvent(
|
||||||
|
LogoutFormEvent event,
|
||||||
|
Emitter<LogoutFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
submitted: (e) async {
|
||||||
|
emit(state.copyWith(isSubmitting: true, failureOrAuthOption: none()));
|
||||||
|
final failureOrAuth = await _repository.logout();
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrAuthOption: optionOf(failureOrAuth),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,335 @@
|
|||||||
|
// 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 'logout_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 _$LogoutFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $LogoutFormEventCopyWith<$Res> {
|
||||||
|
factory $LogoutFormEventCopyWith(
|
||||||
|
LogoutFormEvent value,
|
||||||
|
$Res Function(LogoutFormEvent) then,
|
||||||
|
) = _$LogoutFormEventCopyWithImpl<$Res, LogoutFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$LogoutFormEventCopyWithImpl<$Res, $Val extends LogoutFormEvent>
|
||||||
|
implements $LogoutFormEventCopyWith<$Res> {
|
||||||
|
_$LogoutFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$LogoutFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'LogoutFormEvent.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() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements LogoutFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$LogoutFormState {
|
||||||
|
Option<Either<AuthFailure, Unit>> get failureOrAuthOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$LogoutFormStateCopyWith<LogoutFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $LogoutFormStateCopyWith<$Res> {
|
||||||
|
factory $LogoutFormStateCopyWith(
|
||||||
|
LogoutFormState value,
|
||||||
|
$Res Function(LogoutFormState) then,
|
||||||
|
) = _$LogoutFormStateCopyWithImpl<$Res, LogoutFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$LogoutFormStateCopyWithImpl<$Res, $Val extends LogoutFormState>
|
||||||
|
implements $LogoutFormStateCopyWith<$Res> {
|
||||||
|
_$LogoutFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? failureOrAuthOption = null, Object? isSubmitting = null}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
failureOrAuthOption: null == failureOrAuthOption
|
||||||
|
? _value.failureOrAuthOption
|
||||||
|
: failureOrAuthOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Unit>>,
|
||||||
|
isSubmitting: null == isSubmitting
|
||||||
|
? _value.isSubmitting
|
||||||
|
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$LogoutFormStateImplCopyWith<$Res>
|
||||||
|
implements $LogoutFormStateCopyWith<$Res> {
|
||||||
|
factory _$$LogoutFormStateImplCopyWith(
|
||||||
|
_$LogoutFormStateImpl value,
|
||||||
|
$Res Function(_$LogoutFormStateImpl) then,
|
||||||
|
) = __$$LogoutFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$LogoutFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$LogoutFormStateCopyWithImpl<$Res, _$LogoutFormStateImpl>
|
||||||
|
implements _$$LogoutFormStateImplCopyWith<$Res> {
|
||||||
|
__$$LogoutFormStateImplCopyWithImpl(
|
||||||
|
_$LogoutFormStateImpl _value,
|
||||||
|
$Res Function(_$LogoutFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? failureOrAuthOption = null, Object? isSubmitting = null}) {
|
||||||
|
return _then(
|
||||||
|
_$LogoutFormStateImpl(
|
||||||
|
failureOrAuthOption: null == failureOrAuthOption
|
||||||
|
? _value.failureOrAuthOption
|
||||||
|
: failureOrAuthOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Unit>>,
|
||||||
|
isSubmitting: null == isSubmitting
|
||||||
|
? _value.isSubmitting
|
||||||
|
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$LogoutFormStateImpl implements _LogoutFormState {
|
||||||
|
const _$LogoutFormStateImpl({
|
||||||
|
required this.failureOrAuthOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, Unit>> failureOrAuthOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'LogoutFormState(failureOrAuthOption: $failureOrAuthOption, isSubmitting: $isSubmitting)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$LogoutFormStateImpl &&
|
||||||
|
(identical(other.failureOrAuthOption, failureOrAuthOption) ||
|
||||||
|
other.failureOrAuthOption == failureOrAuthOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, failureOrAuthOption, isSubmitting);
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$LogoutFormStateImplCopyWith<_$LogoutFormStateImpl> get copyWith =>
|
||||||
|
__$$LogoutFormStateImplCopyWithImpl<_$LogoutFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _LogoutFormState implements LogoutFormState {
|
||||||
|
const factory _LogoutFormState({
|
||||||
|
required final Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
}) = _$LogoutFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, Unit>> get failureOrAuthOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
|
||||||
|
/// Create a copy of LogoutFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$LogoutFormStateImplCopyWith<_$LogoutFormStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
part of 'logout_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class LogoutFormEvent with _$LogoutFormEvent {
|
||||||
|
const factory LogoutFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
part of 'logout_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class LogoutFormState with _$LogoutFormState {
|
||||||
|
const factory LogoutFormState({
|
||||||
|
required Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
}) = _LogoutFormState;
|
||||||
|
|
||||||
|
factory LogoutFormState.initial() =>
|
||||||
|
LogoutFormState(failureOrAuthOption: none(), isSubmitting: false);
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
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 'resend_form_event.dart';
|
||||||
|
part 'resend_form_state.dart';
|
||||||
|
part 'resend_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class ResendFormBloc extends Bloc<ResendFormEvent, ResendFormState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
ResendFormBloc(this._repository) : super(ResendFormState.initial()) {
|
||||||
|
on<ResendFormEvent>(_onResendFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onResendFormEvent(
|
||||||
|
ResendFormEvent event,
|
||||||
|
Emitter<ResendFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
phoneNumberChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
phoneNumber: e.phoneNumber,
|
||||||
|
failureOrResendOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
purposeChanged: (e) async {
|
||||||
|
emit(state.copyWith(purpose: e.purpose, failureOrResendOption: none()));
|
||||||
|
},
|
||||||
|
submitted: (e) async {
|
||||||
|
Either<AuthFailure, Resend>? failureOrResend;
|
||||||
|
emit(state.copyWith(isSubmitting: true, failureOrResendOption: none()));
|
||||||
|
|
||||||
|
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||||
|
final purposeValid = state.purpose.isNotEmpty;
|
||||||
|
|
||||||
|
if (phoneNumberValid && purposeValid) {
|
||||||
|
failureOrResend = await _repository.resend(
|
||||||
|
phoneNumber: state.phoneNumber,
|
||||||
|
purpose: state.purpose,
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrResendOption: optionOf(failureOrResend),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,738 @@
|
|||||||
|
// 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 'resend_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 _$ResendFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String purpose) purposeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String purpose)? purposeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String purpose)? purposeChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_PurposeChanged value) purposeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ResendFormEventCopyWith<$Res> {
|
||||||
|
factory $ResendFormEventCopyWith(
|
||||||
|
ResendFormEvent value,
|
||||||
|
$Res Function(ResendFormEvent) then,
|
||||||
|
) = _$ResendFormEventCopyWithImpl<$Res, ResendFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ResendFormEventCopyWithImpl<$Res, $Val extends ResendFormEvent>
|
||||||
|
implements $ResendFormEventCopyWith<$Res> {
|
||||||
|
_$ResendFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// 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 _$ResendFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||||
|
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||||
|
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||||
|
_$PhoneNumberChangedImpl _value,
|
||||||
|
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// 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 'ResendFormEvent.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 ResendFormEvent
|
||||||
|
/// 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 purpose) purposeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String purpose)? purposeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String purpose)? purposeChanged,
|
||||||
|
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(_PurposeChanged value) purposeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return phoneNumberChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (phoneNumberChanged != null) {
|
||||||
|
return phoneNumberChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PhoneNumberChanged implements ResendFormEvent {
|
||||||
|
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||||
|
_$PhoneNumberChangedImpl;
|
||||||
|
|
||||||
|
String get phoneNumber;
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// 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 _$$PurposeChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$PurposeChangedImplCopyWith(
|
||||||
|
_$PurposeChangedImpl value,
|
||||||
|
$Res Function(_$PurposeChangedImpl) then,
|
||||||
|
) = __$$PurposeChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String purpose});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$PurposeChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$ResendFormEventCopyWithImpl<$Res, _$PurposeChangedImpl>
|
||||||
|
implements _$$PurposeChangedImplCopyWith<$Res> {
|
||||||
|
__$$PurposeChangedImplCopyWithImpl(
|
||||||
|
_$PurposeChangedImpl _value,
|
||||||
|
$Res Function(_$PurposeChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? purpose = null}) {
|
||||||
|
return _then(
|
||||||
|
_$PurposeChangedImpl(
|
||||||
|
null == purpose
|
||||||
|
? _value.purpose
|
||||||
|
: purpose // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$PurposeChangedImpl implements _PurposeChanged {
|
||||||
|
const _$PurposeChangedImpl(this.purpose);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String purpose;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ResendFormEvent.purposeChanged(purpose: $purpose)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$PurposeChangedImpl &&
|
||||||
|
(identical(other.purpose, purpose) || other.purpose == purpose));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, purpose);
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$PurposeChangedImplCopyWith<_$PurposeChangedImpl> get copyWith =>
|
||||||
|
__$$PurposeChangedImplCopyWithImpl<_$PurposeChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||||
|
required TResult Function(String purpose) purposeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return purposeChanged(purpose);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String purpose)? purposeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return purposeChanged?.call(purpose);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String purpose)? purposeChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (purposeChanged != null) {
|
||||||
|
return purposeChanged(purpose);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||||
|
required TResult Function(_PurposeChanged value) purposeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return purposeChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return purposeChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (purposeChanged != null) {
|
||||||
|
return purposeChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PurposeChanged implements ResendFormEvent {
|
||||||
|
const factory _PurposeChanged(final String purpose) = _$PurposeChangedImpl;
|
||||||
|
|
||||||
|
String get purpose;
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$PurposeChangedImplCopyWith<_$PurposeChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$ResendFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ResendFormEvent.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 purpose) purposeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult? Function(String purpose)? purposeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||||
|
TResult Function(String purpose)? purposeChanged,
|
||||||
|
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(_PurposeChanged value) purposeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||||
|
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements ResendFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ResendFormState {
|
||||||
|
String get phoneNumber => throw _privateConstructorUsedError;
|
||||||
|
String get purpose => throw _privateConstructorUsedError;
|
||||||
|
Option<Either<AuthFailure, Resend>> get failureOrResendOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$ResendFormStateCopyWith<ResendFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ResendFormStateCopyWith<$Res> {
|
||||||
|
factory $ResendFormStateCopyWith(
|
||||||
|
ResendFormState value,
|
||||||
|
$Res Function(ResendFormState) then,
|
||||||
|
) = _$ResendFormStateCopyWithImpl<$Res, ResendFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
String purpose,
|
||||||
|
Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ResendFormStateCopyWithImpl<$Res, $Val extends ResendFormState>
|
||||||
|
implements $ResendFormStateCopyWith<$Res> {
|
||||||
|
_$ResendFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? purpose = null,
|
||||||
|
Object? failureOrResendOption = 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,
|
||||||
|
purpose: null == purpose
|
||||||
|
? _value.purpose
|
||||||
|
: purpose // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrResendOption: null == failureOrResendOption
|
||||||
|
? _value.failureOrResendOption
|
||||||
|
: failureOrResendOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Resend>>,
|
||||||
|
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 _$$ResendFormStateImplCopyWith<$Res>
|
||||||
|
implements $ResendFormStateCopyWith<$Res> {
|
||||||
|
factory _$$ResendFormStateImplCopyWith(
|
||||||
|
_$ResendFormStateImpl value,
|
||||||
|
$Res Function(_$ResendFormStateImpl) then,
|
||||||
|
) = __$$ResendFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String phoneNumber,
|
||||||
|
String purpose,
|
||||||
|
Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ResendFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$ResendFormStateCopyWithImpl<$Res, _$ResendFormStateImpl>
|
||||||
|
implements _$$ResendFormStateImplCopyWith<$Res> {
|
||||||
|
__$$ResendFormStateImplCopyWithImpl(
|
||||||
|
_$ResendFormStateImpl _value,
|
||||||
|
$Res Function(_$ResendFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? phoneNumber = null,
|
||||||
|
Object? purpose = null,
|
||||||
|
Object? failureOrResendOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$ResendFormStateImpl(
|
||||||
|
phoneNumber: null == phoneNumber
|
||||||
|
? _value.phoneNumber
|
||||||
|
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
purpose: null == purpose
|
||||||
|
? _value.purpose
|
||||||
|
: purpose // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrResendOption: null == failureOrResendOption
|
||||||
|
? _value.failureOrResendOption
|
||||||
|
: failureOrResendOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Resend>>,
|
||||||
|
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 _$ResendFormStateImpl implements _ResendFormState {
|
||||||
|
const _$ResendFormStateImpl({
|
||||||
|
required this.phoneNumber,
|
||||||
|
required this.purpose,
|
||||||
|
required this.failureOrResendOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
this.showErrorMessages = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String phoneNumber;
|
||||||
|
@override
|
||||||
|
final String purpose;
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, Resend>> failureOrResendOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool showErrorMessages;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ResendFormState(phoneNumber: $phoneNumber, purpose: $purpose, failureOrResendOption: $failureOrResendOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ResendFormStateImpl &&
|
||||||
|
(identical(other.phoneNumber, phoneNumber) ||
|
||||||
|
other.phoneNumber == phoneNumber) &&
|
||||||
|
(identical(other.purpose, purpose) || other.purpose == purpose) &&
|
||||||
|
(identical(other.failureOrResendOption, failureOrResendOption) ||
|
||||||
|
other.failureOrResendOption == failureOrResendOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting) &&
|
||||||
|
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||||
|
other.showErrorMessages == showErrorMessages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
phoneNumber,
|
||||||
|
purpose,
|
||||||
|
failureOrResendOption,
|
||||||
|
isSubmitting,
|
||||||
|
showErrorMessages,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ResendFormStateImplCopyWith<_$ResendFormStateImpl> get copyWith =>
|
||||||
|
__$$ResendFormStateImplCopyWithImpl<_$ResendFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ResendFormState implements ResendFormState {
|
||||||
|
const factory _ResendFormState({
|
||||||
|
required final String phoneNumber,
|
||||||
|
required final String purpose,
|
||||||
|
required final Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
final bool showErrorMessages,
|
||||||
|
}) = _$ResendFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get phoneNumber;
|
||||||
|
@override
|
||||||
|
String get purpose;
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, Resend>> get failureOrResendOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
@override
|
||||||
|
bool get showErrorMessages;
|
||||||
|
|
||||||
|
/// Create a copy of ResendFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ResendFormStateImplCopyWith<_$ResendFormStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
part of 'resend_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ResendFormEvent with _$ResendFormEvent {
|
||||||
|
const factory ResendFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||||
|
_PhoneNumberChanged;
|
||||||
|
const factory ResendFormEvent.purposeChanged(String purpose) =
|
||||||
|
_PurposeChanged;
|
||||||
|
const factory ResendFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
part of 'resend_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ResendFormState with _$ResendFormState {
|
||||||
|
const factory ResendFormState({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String purpose,
|
||||||
|
required Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
@Default(false) bool showErrorMessages,
|
||||||
|
}) = _ResendFormState;
|
||||||
|
|
||||||
|
factory ResendFormState.initial() => ResendFormState(
|
||||||
|
phoneNumber: '',
|
||||||
|
purpose: '',
|
||||||
|
failureOrResendOption: none(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
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 'set_password_form_event.dart';
|
||||||
|
part 'set_password_form_state.dart';
|
||||||
|
part 'set_password_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class SetPasswordFormBloc
|
||||||
|
extends Bloc<SetPasswordFormEvent, SetPasswordFormState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
SetPasswordFormBloc(this._repository)
|
||||||
|
: super(SetPasswordFormState.initial()) {
|
||||||
|
on<SetPasswordFormEvent>(_onSetPasswordFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onSetPasswordFormEvent(
|
||||||
|
SetPasswordFormEvent event,
|
||||||
|
Emitter<SetPasswordFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
registrationTokenChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
registrationToken: e.registrationToken,
|
||||||
|
failureOrSetPasswordOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
passwordChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
password: e.password,
|
||||||
|
failureOrSetPasswordOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
confirmPasswordChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
confirmPassword: e.confirmPassword,
|
||||||
|
failureOrSetPasswordOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
submitted: (e) async {
|
||||||
|
Either<AuthFailure, Login>? failureOrSetPassword;
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: true,
|
||||||
|
failureOrSetPasswordOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final registrationTokenValid = state.registrationToken.isNotEmpty;
|
||||||
|
final passwordValid = state.password.isNotEmpty;
|
||||||
|
final confirmPasswordValid = state.confirmPassword.isNotEmpty;
|
||||||
|
|
||||||
|
if (registrationTokenValid && passwordValid && confirmPasswordValid) {
|
||||||
|
failureOrSetPassword = await _repository.setPassword(
|
||||||
|
registrationToken: state.registrationToken,
|
||||||
|
password: state.password,
|
||||||
|
confirmPassword: state.confirmPassword,
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrSetPasswordOption: optionOf(failureOrSetPassword),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,980 @@
|
|||||||
|
// 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 'set_password_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 _$SetPasswordFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_ConfirmPasswordChanged value)
|
||||||
|
confirmPasswordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $SetPasswordFormEventCopyWith<$Res> {
|
||||||
|
factory $SetPasswordFormEventCopyWith(
|
||||||
|
SetPasswordFormEvent value,
|
||||||
|
$Res Function(SetPasswordFormEvent) then,
|
||||||
|
) = _$SetPasswordFormEventCopyWithImpl<$Res, SetPasswordFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$SetPasswordFormEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends SetPasswordFormEvent
|
||||||
|
>
|
||||||
|
implements $SetPasswordFormEventCopyWith<$Res> {
|
||||||
|
_$SetPasswordFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RegistrationTokenChangedImplCopyWith(
|
||||||
|
_$RegistrationTokenChangedImpl value,
|
||||||
|
$Res Function(_$RegistrationTokenChangedImpl) then,
|
||||||
|
) = __$$RegistrationTokenChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String registrationToken});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RegistrationTokenChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$SetPasswordFormEventCopyWithImpl<$Res, _$RegistrationTokenChangedImpl>
|
||||||
|
implements _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||||
|
__$$RegistrationTokenChangedImplCopyWithImpl(
|
||||||
|
_$RegistrationTokenChangedImpl _value,
|
||||||
|
$Res Function(_$RegistrationTokenChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? registrationToken = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RegistrationTokenChangedImpl(
|
||||||
|
null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RegistrationTokenChangedImpl implements _RegistrationTokenChanged {
|
||||||
|
const _$RegistrationTokenChangedImpl(this.registrationToken);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String registrationToken;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SetPasswordFormEvent.registrationTokenChanged(registrationToken: $registrationToken)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RegistrationTokenChangedImpl &&
|
||||||
|
(identical(other.registrationToken, registrationToken) ||
|
||||||
|
other.registrationToken == registrationToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, registrationToken);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$RegistrationTokenChangedImplCopyWithImpl<
|
||||||
|
_$RegistrationTokenChangedImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged(registrationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged?.call(registrationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (registrationTokenChanged != null) {
|
||||||
|
return registrationTokenChanged(registrationToken);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_ConfirmPasswordChanged value)
|
||||||
|
confirmPasswordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (registrationTokenChanged != null) {
|
||||||
|
return registrationTokenChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RegistrationTokenChanged implements SetPasswordFormEvent {
|
||||||
|
const factory _RegistrationTokenChanged(final String registrationToken) =
|
||||||
|
_$RegistrationTokenChangedImpl;
|
||||||
|
|
||||||
|
String get registrationToken;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$PasswordChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$PasswordChangedImplCopyWith(
|
||||||
|
_$PasswordChangedImpl value,
|
||||||
|
$Res Function(_$PasswordChangedImpl) then,
|
||||||
|
) = __$$PasswordChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String password});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$PasswordChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$SetPasswordFormEventCopyWithImpl<$Res, _$PasswordChangedImpl>
|
||||||
|
implements _$$PasswordChangedImplCopyWith<$Res> {
|
||||||
|
__$$PasswordChangedImplCopyWithImpl(
|
||||||
|
_$PasswordChangedImpl _value,
|
||||||
|
$Res Function(_$PasswordChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? password = null}) {
|
||||||
|
return _then(
|
||||||
|
_$PasswordChangedImpl(
|
||||||
|
null == password
|
||||||
|
? _value.password
|
||||||
|
: password // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$PasswordChangedImpl implements _PasswordChanged {
|
||||||
|
const _$PasswordChangedImpl(this.password);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String password;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SetPasswordFormEvent.passwordChanged(password: $password)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$PasswordChangedImpl &&
|
||||||
|
(identical(other.password, password) ||
|
||||||
|
other.password == password));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, password);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||||
|
__$$PasswordChangedImplCopyWithImpl<_$PasswordChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged?.call(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (passwordChanged != null) {
|
||||||
|
return passwordChanged(password);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_ConfirmPasswordChanged value)
|
||||||
|
confirmPasswordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return passwordChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (passwordChanged != null) {
|
||||||
|
return passwordChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _PasswordChanged implements SetPasswordFormEvent {
|
||||||
|
const factory _PasswordChanged(final String password) = _$PasswordChangedImpl;
|
||||||
|
|
||||||
|
String get password;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ConfirmPasswordChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$ConfirmPasswordChangedImplCopyWith(
|
||||||
|
_$ConfirmPasswordChangedImpl value,
|
||||||
|
$Res Function(_$ConfirmPasswordChangedImpl) then,
|
||||||
|
) = __$$ConfirmPasswordChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String confirmPassword});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ConfirmPasswordChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$SetPasswordFormEventCopyWithImpl<$Res, _$ConfirmPasswordChangedImpl>
|
||||||
|
implements _$$ConfirmPasswordChangedImplCopyWith<$Res> {
|
||||||
|
__$$ConfirmPasswordChangedImplCopyWithImpl(
|
||||||
|
_$ConfirmPasswordChangedImpl _value,
|
||||||
|
$Res Function(_$ConfirmPasswordChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? confirmPassword = null}) {
|
||||||
|
return _then(
|
||||||
|
_$ConfirmPasswordChangedImpl(
|
||||||
|
null == confirmPassword
|
||||||
|
? _value.confirmPassword
|
||||||
|
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ConfirmPasswordChangedImpl implements _ConfirmPasswordChanged {
|
||||||
|
const _$ConfirmPasswordChangedImpl(this.confirmPassword);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String confirmPassword;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SetPasswordFormEvent.confirmPasswordChanged(confirmPassword: $confirmPassword)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ConfirmPasswordChangedImpl &&
|
||||||
|
(identical(other.confirmPassword, confirmPassword) ||
|
||||||
|
other.confirmPassword == confirmPassword));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, confirmPassword);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ConfirmPasswordChangedImplCopyWith<_$ConfirmPasswordChangedImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$ConfirmPasswordChangedImplCopyWithImpl<_$ConfirmPasswordChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return confirmPasswordChanged(confirmPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return confirmPasswordChanged?.call(confirmPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (confirmPasswordChanged != null) {
|
||||||
|
return confirmPasswordChanged(confirmPassword);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_ConfirmPasswordChanged value)
|
||||||
|
confirmPasswordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return confirmPasswordChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return confirmPasswordChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (confirmPasswordChanged != null) {
|
||||||
|
return confirmPasswordChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ConfirmPasswordChanged implements SetPasswordFormEvent {
|
||||||
|
const factory _ConfirmPasswordChanged(final String confirmPassword) =
|
||||||
|
_$ConfirmPasswordChangedImpl;
|
||||||
|
|
||||||
|
String get confirmPassword;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ConfirmPasswordChangedImplCopyWith<_$ConfirmPasswordChangedImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$SetPasswordFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SetPasswordFormEvent.submitted()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String password) passwordChanged,
|
||||||
|
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String password)? passwordChanged,
|
||||||
|
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String password)? passwordChanged,
|
||||||
|
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||||
|
required TResult Function(_ConfirmPasswordChanged value)
|
||||||
|
confirmPasswordChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||||
|
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements SetPasswordFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$SetPasswordFormState {
|
||||||
|
String get registrationToken => throw _privateConstructorUsedError;
|
||||||
|
String get password => throw _privateConstructorUsedError;
|
||||||
|
String get confirmPassword => throw _privateConstructorUsedError;
|
||||||
|
Option<Either<AuthFailure, Login>> get failureOrSetPasswordOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$SetPasswordFormStateCopyWith<SetPasswordFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $SetPasswordFormStateCopyWith<$Res> {
|
||||||
|
factory $SetPasswordFormStateCopyWith(
|
||||||
|
SetPasswordFormState value,
|
||||||
|
$Res Function(SetPasswordFormState) then,
|
||||||
|
) = _$SetPasswordFormStateCopyWithImpl<$Res, SetPasswordFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String registrationToken,
|
||||||
|
String password,
|
||||||
|
String confirmPassword,
|
||||||
|
Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$SetPasswordFormStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends SetPasswordFormState
|
||||||
|
>
|
||||||
|
implements $SetPasswordFormStateCopyWith<$Res> {
|
||||||
|
_$SetPasswordFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? registrationToken = null,
|
||||||
|
Object? password = null,
|
||||||
|
Object? confirmPassword = null,
|
||||||
|
Object? failureOrSetPasswordOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
registrationToken: null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
password: null == password
|
||||||
|
? _value.password
|
||||||
|
: password // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
confirmPassword: null == confirmPassword
|
||||||
|
? _value.confirmPassword
|
||||||
|
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrSetPasswordOption: null == failureOrSetPasswordOption
|
||||||
|
? _value.failureOrSetPasswordOption
|
||||||
|
: failureOrSetPasswordOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Login>>,
|
||||||
|
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 _$$SetPasswordFormStateImplCopyWith<$Res>
|
||||||
|
implements $SetPasswordFormStateCopyWith<$Res> {
|
||||||
|
factory _$$SetPasswordFormStateImplCopyWith(
|
||||||
|
_$SetPasswordFormStateImpl value,
|
||||||
|
$Res Function(_$SetPasswordFormStateImpl) then,
|
||||||
|
) = __$$SetPasswordFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String registrationToken,
|
||||||
|
String password,
|
||||||
|
String confirmPassword,
|
||||||
|
Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SetPasswordFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$SetPasswordFormStateCopyWithImpl<$Res, _$SetPasswordFormStateImpl>
|
||||||
|
implements _$$SetPasswordFormStateImplCopyWith<$Res> {
|
||||||
|
__$$SetPasswordFormStateImplCopyWithImpl(
|
||||||
|
_$SetPasswordFormStateImpl _value,
|
||||||
|
$Res Function(_$SetPasswordFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? registrationToken = null,
|
||||||
|
Object? password = null,
|
||||||
|
Object? confirmPassword = null,
|
||||||
|
Object? failureOrSetPasswordOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$SetPasswordFormStateImpl(
|
||||||
|
registrationToken: null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
password: null == password
|
||||||
|
? _value.password
|
||||||
|
: password // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
confirmPassword: null == confirmPassword
|
||||||
|
? _value.confirmPassword
|
||||||
|
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrSetPasswordOption: null == failureOrSetPasswordOption
|
||||||
|
? _value.failureOrSetPasswordOption
|
||||||
|
: failureOrSetPasswordOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Login>>,
|
||||||
|
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 _$SetPasswordFormStateImpl implements _SetPasswordFormState {
|
||||||
|
const _$SetPasswordFormStateImpl({
|
||||||
|
required this.registrationToken,
|
||||||
|
required this.password,
|
||||||
|
required this.confirmPassword,
|
||||||
|
required this.failureOrSetPasswordOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
this.showErrorMessages = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String registrationToken;
|
||||||
|
@override
|
||||||
|
final String password;
|
||||||
|
@override
|
||||||
|
final String confirmPassword;
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, Login>> failureOrSetPasswordOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool showErrorMessages;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SetPasswordFormState(registrationToken: $registrationToken, password: $password, confirmPassword: $confirmPassword, failureOrSetPasswordOption: $failureOrSetPasswordOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$SetPasswordFormStateImpl &&
|
||||||
|
(identical(other.registrationToken, registrationToken) ||
|
||||||
|
other.registrationToken == registrationToken) &&
|
||||||
|
(identical(other.password, password) ||
|
||||||
|
other.password == password) &&
|
||||||
|
(identical(other.confirmPassword, confirmPassword) ||
|
||||||
|
other.confirmPassword == confirmPassword) &&
|
||||||
|
(identical(
|
||||||
|
other.failureOrSetPasswordOption,
|
||||||
|
failureOrSetPasswordOption,
|
||||||
|
) ||
|
||||||
|
other.failureOrSetPasswordOption ==
|
||||||
|
failureOrSetPasswordOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting) &&
|
||||||
|
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||||
|
other.showErrorMessages == showErrorMessages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
registrationToken,
|
||||||
|
password,
|
||||||
|
confirmPassword,
|
||||||
|
failureOrSetPasswordOption,
|
||||||
|
isSubmitting,
|
||||||
|
showErrorMessages,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$SetPasswordFormStateImplCopyWith<_$SetPasswordFormStateImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$SetPasswordFormStateImplCopyWithImpl<_$SetPasswordFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _SetPasswordFormState implements SetPasswordFormState {
|
||||||
|
const factory _SetPasswordFormState({
|
||||||
|
required final String registrationToken,
|
||||||
|
required final String password,
|
||||||
|
required final String confirmPassword,
|
||||||
|
required final Option<Either<AuthFailure, Login>>
|
||||||
|
failureOrSetPasswordOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
final bool showErrorMessages,
|
||||||
|
}) = _$SetPasswordFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get registrationToken;
|
||||||
|
@override
|
||||||
|
String get password;
|
||||||
|
@override
|
||||||
|
String get confirmPassword;
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, Login>> get failureOrSetPasswordOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
@override
|
||||||
|
bool get showErrorMessages;
|
||||||
|
|
||||||
|
/// Create a copy of SetPasswordFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$SetPasswordFormStateImplCopyWith<_$SetPasswordFormStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
part of 'set_password_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class SetPasswordFormEvent with _$SetPasswordFormEvent {
|
||||||
|
const factory SetPasswordFormEvent.registrationTokenChanged(
|
||||||
|
String registrationToken,
|
||||||
|
) = _RegistrationTokenChanged;
|
||||||
|
const factory SetPasswordFormEvent.passwordChanged(String password) =
|
||||||
|
_PasswordChanged;
|
||||||
|
const factory SetPasswordFormEvent.confirmPasswordChanged(
|
||||||
|
String confirmPassword,
|
||||||
|
) = _ConfirmPasswordChanged;
|
||||||
|
const factory SetPasswordFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
part of 'set_password_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class SetPasswordFormState with _$SetPasswordFormState {
|
||||||
|
const factory SetPasswordFormState({
|
||||||
|
required String registrationToken,
|
||||||
|
required String password,
|
||||||
|
required String confirmPassword,
|
||||||
|
required Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
@Default(false) bool showErrorMessages,
|
||||||
|
}) = _SetPasswordFormState;
|
||||||
|
|
||||||
|
factory SetPasswordFormState.initial() => SetPasswordFormState(
|
||||||
|
registrationToken: '',
|
||||||
|
password: '',
|
||||||
|
confirmPassword: '',
|
||||||
|
failureOrSetPasswordOption: none(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/auth/auth.dart';
|
||||||
|
|
||||||
|
part 'verify_form_event.dart';
|
||||||
|
part 'verify_form_state.dart';
|
||||||
|
part 'verify_form_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class VerifyFormBloc extends Bloc<VerifyFormEvent, VerifyFormState> {
|
||||||
|
final IAuthRepository _repository;
|
||||||
|
VerifyFormBloc(this._repository) : super(VerifyFormState.initial()) {
|
||||||
|
on<VerifyFormEvent>(_onVerifyFormEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onVerifyFormEvent(
|
||||||
|
VerifyFormEvent event,
|
||||||
|
Emitter<VerifyFormState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
registrationTokenChanged: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
registrationToken: e.registrationToken,
|
||||||
|
failureOrVerifyOption: none(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
otpCodeChanged: (e) async {
|
||||||
|
emit(state.copyWith(otpCode: e.otpCode, failureOrVerifyOption: none()));
|
||||||
|
},
|
||||||
|
submitted: (e) async {
|
||||||
|
Either<AuthFailure, Verify>? failureOrVerify;
|
||||||
|
emit(state.copyWith(isSubmitting: true, failureOrVerifyOption: none()));
|
||||||
|
|
||||||
|
final otpCodeValid = state.otpCode.isNotEmpty;
|
||||||
|
final registrationTokenValid = state.registrationToken.isNotEmpty;
|
||||||
|
|
||||||
|
if (registrationTokenValid && otpCodeValid) {
|
||||||
|
failureOrVerify = await _repository.verify(
|
||||||
|
registrationToken: state.registrationToken,
|
||||||
|
otpCode: state.otpCode,
|
||||||
|
);
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isSubmitting: false,
|
||||||
|
failureOrVerifyOption: optionOf(failureOrVerify),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,750 @@
|
|||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'verify_form_bloc.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||||
|
);
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$VerifyFormEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String otpCode) otpCodeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $VerifyFormEventCopyWith<$Res> {
|
||||||
|
factory $VerifyFormEventCopyWith(
|
||||||
|
VerifyFormEvent value,
|
||||||
|
$Res Function(VerifyFormEvent) then,
|
||||||
|
) = _$VerifyFormEventCopyWithImpl<$Res, VerifyFormEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$VerifyFormEventCopyWithImpl<$Res, $Val extends VerifyFormEvent>
|
||||||
|
implements $VerifyFormEventCopyWith<$Res> {
|
||||||
|
_$VerifyFormEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RegistrationTokenChangedImplCopyWith(
|
||||||
|
_$RegistrationTokenChangedImpl value,
|
||||||
|
$Res Function(_$RegistrationTokenChangedImpl) then,
|
||||||
|
) = __$$RegistrationTokenChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String registrationToken});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RegistrationTokenChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$VerifyFormEventCopyWithImpl<$Res, _$RegistrationTokenChangedImpl>
|
||||||
|
implements _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||||
|
__$$RegistrationTokenChangedImplCopyWithImpl(
|
||||||
|
_$RegistrationTokenChangedImpl _value,
|
||||||
|
$Res Function(_$RegistrationTokenChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? registrationToken = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RegistrationTokenChangedImpl(
|
||||||
|
null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RegistrationTokenChangedImpl implements _RegistrationTokenChanged {
|
||||||
|
const _$RegistrationTokenChangedImpl(this.registrationToken);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String registrationToken;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyFormEvent.registrationTokenChanged(registrationToken: $registrationToken)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RegistrationTokenChangedImpl &&
|
||||||
|
(identical(other.registrationToken, registrationToken) ||
|
||||||
|
other.registrationToken == registrationToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, registrationToken);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$RegistrationTokenChangedImplCopyWithImpl<
|
||||||
|
_$RegistrationTokenChangedImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String otpCode) otpCodeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged(registrationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged?.call(registrationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (registrationTokenChanged != null) {
|
||||||
|
return registrationTokenChanged(registrationToken);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return registrationTokenChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (registrationTokenChanged != null) {
|
||||||
|
return registrationTokenChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RegistrationTokenChanged implements VerifyFormEvent {
|
||||||
|
const factory _RegistrationTokenChanged(final String registrationToken) =
|
||||||
|
_$RegistrationTokenChangedImpl;
|
||||||
|
|
||||||
|
String get registrationToken;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$OtpCodeChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$OtpCodeChangedImplCopyWith(
|
||||||
|
_$OtpCodeChangedImpl value,
|
||||||
|
$Res Function(_$OtpCodeChangedImpl) then,
|
||||||
|
) = __$$OtpCodeChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String otpCode});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$OtpCodeChangedImplCopyWithImpl<$Res>
|
||||||
|
extends _$VerifyFormEventCopyWithImpl<$Res, _$OtpCodeChangedImpl>
|
||||||
|
implements _$$OtpCodeChangedImplCopyWith<$Res> {
|
||||||
|
__$$OtpCodeChangedImplCopyWithImpl(
|
||||||
|
_$OtpCodeChangedImpl _value,
|
||||||
|
$Res Function(_$OtpCodeChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? otpCode = null}) {
|
||||||
|
return _then(
|
||||||
|
_$OtpCodeChangedImpl(
|
||||||
|
null == otpCode
|
||||||
|
? _value.otpCode
|
||||||
|
: otpCode // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$OtpCodeChangedImpl implements _OtpCodeChanged {
|
||||||
|
const _$OtpCodeChangedImpl(this.otpCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String otpCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyFormEvent.otpCodeChanged(otpCode: $otpCode)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$OtpCodeChangedImpl &&
|
||||||
|
(identical(other.otpCode, otpCode) || other.otpCode == otpCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, otpCode);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$OtpCodeChangedImplCopyWith<_$OtpCodeChangedImpl> get copyWith =>
|
||||||
|
__$$OtpCodeChangedImplCopyWithImpl<_$OtpCodeChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String otpCode) otpCodeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return otpCodeChanged(otpCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return otpCodeChanged?.call(otpCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (otpCodeChanged != null) {
|
||||||
|
return otpCodeChanged(otpCode);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return otpCodeChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return otpCodeChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (otpCodeChanged != null) {
|
||||||
|
return otpCodeChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _OtpCodeChanged implements VerifyFormEvent {
|
||||||
|
const factory _OtpCodeChanged(final String otpCode) = _$OtpCodeChangedImpl;
|
||||||
|
|
||||||
|
String get otpCode;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$OtpCodeChangedImplCopyWith<_$OtpCodeChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
factory _$$SubmittedImplCopyWith(
|
||||||
|
_$SubmittedImpl value,
|
||||||
|
$Res Function(_$SubmittedImpl) then,
|
||||||
|
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||||
|
extends _$VerifyFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||||
|
implements _$$SubmittedImplCopyWith<$Res> {
|
||||||
|
__$$SubmittedImplCopyWithImpl(
|
||||||
|
_$SubmittedImpl _value,
|
||||||
|
$Res Function(_$SubmittedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SubmittedImpl implements _Submitted {
|
||||||
|
const _$SubmittedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyFormEvent.submitted()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String registrationToken)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(String otpCode) otpCodeChanged,
|
||||||
|
required TResult Function() submitted,
|
||||||
|
}) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult? Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult? Function()? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||||
|
TResult Function(String otpCode)? otpCodeChanged,
|
||||||
|
TResult Function()? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RegistrationTokenChanged value)
|
||||||
|
registrationTokenChanged,
|
||||||
|
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||||
|
required TResult Function(_Submitted value) submitted,
|
||||||
|
}) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RegistrationTokenChanged value)?
|
||||||
|
registrationTokenChanged,
|
||||||
|
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult? Function(_Submitted value)? submitted,
|
||||||
|
}) {
|
||||||
|
return submitted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||||
|
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||||
|
TResult Function(_Submitted value)? submitted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (submitted != null) {
|
||||||
|
return submitted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Submitted implements VerifyFormEvent {
|
||||||
|
const factory _Submitted() = _$SubmittedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$VerifyFormState {
|
||||||
|
String get registrationToken => throw _privateConstructorUsedError;
|
||||||
|
String get otpCode => throw _privateConstructorUsedError;
|
||||||
|
Option<Either<AuthFailure, Verify>> get failureOrVerifyOption =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||||
|
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$VerifyFormStateCopyWith<VerifyFormState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $VerifyFormStateCopyWith<$Res> {
|
||||||
|
factory $VerifyFormStateCopyWith(
|
||||||
|
VerifyFormState value,
|
||||||
|
$Res Function(VerifyFormState) then,
|
||||||
|
) = _$VerifyFormStateCopyWithImpl<$Res, VerifyFormState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String registrationToken,
|
||||||
|
String otpCode,
|
||||||
|
Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$VerifyFormStateCopyWithImpl<$Res, $Val extends VerifyFormState>
|
||||||
|
implements $VerifyFormStateCopyWith<$Res> {
|
||||||
|
_$VerifyFormStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? registrationToken = null,
|
||||||
|
Object? otpCode = null,
|
||||||
|
Object? failureOrVerifyOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
registrationToken: null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
otpCode: null == otpCode
|
||||||
|
? _value.otpCode
|
||||||
|
: otpCode // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrVerifyOption: null == failureOrVerifyOption
|
||||||
|
? _value.failureOrVerifyOption
|
||||||
|
: failureOrVerifyOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Verify>>,
|
||||||
|
isSubmitting: null == isSubmitting
|
||||||
|
? _value.isSubmitting
|
||||||
|
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
showErrorMessages: null == showErrorMessages
|
||||||
|
? _value.showErrorMessages
|
||||||
|
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$VerifyFormStateImplCopyWith<$Res>
|
||||||
|
implements $VerifyFormStateCopyWith<$Res> {
|
||||||
|
factory _$$VerifyFormStateImplCopyWith(
|
||||||
|
_$VerifyFormStateImpl value,
|
||||||
|
$Res Function(_$VerifyFormStateImpl) then,
|
||||||
|
) = __$$VerifyFormStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String registrationToken,
|
||||||
|
String otpCode,
|
||||||
|
Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||||
|
bool isSubmitting,
|
||||||
|
bool showErrorMessages,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$VerifyFormStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$VerifyFormStateCopyWithImpl<$Res, _$VerifyFormStateImpl>
|
||||||
|
implements _$$VerifyFormStateImplCopyWith<$Res> {
|
||||||
|
__$$VerifyFormStateImplCopyWithImpl(
|
||||||
|
_$VerifyFormStateImpl _value,
|
||||||
|
$Res Function(_$VerifyFormStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? registrationToken = null,
|
||||||
|
Object? otpCode = null,
|
||||||
|
Object? failureOrVerifyOption = null,
|
||||||
|
Object? isSubmitting = null,
|
||||||
|
Object? showErrorMessages = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$VerifyFormStateImpl(
|
||||||
|
registrationToken: null == registrationToken
|
||||||
|
? _value.registrationToken
|
||||||
|
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
otpCode: null == otpCode
|
||||||
|
? _value.otpCode
|
||||||
|
: otpCode // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
failureOrVerifyOption: null == failureOrVerifyOption
|
||||||
|
? _value.failureOrVerifyOption
|
||||||
|
: failureOrVerifyOption // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<AuthFailure, Verify>>,
|
||||||
|
isSubmitting: null == isSubmitting
|
||||||
|
? _value.isSubmitting
|
||||||
|
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
showErrorMessages: null == showErrorMessages
|
||||||
|
? _value.showErrorMessages
|
||||||
|
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$VerifyFormStateImpl implements _VerifyFormState {
|
||||||
|
const _$VerifyFormStateImpl({
|
||||||
|
required this.registrationToken,
|
||||||
|
required this.otpCode,
|
||||||
|
required this.failureOrVerifyOption,
|
||||||
|
this.isSubmitting = false,
|
||||||
|
this.showErrorMessages = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String registrationToken;
|
||||||
|
@override
|
||||||
|
final String otpCode;
|
||||||
|
@override
|
||||||
|
final Option<Either<AuthFailure, Verify>> failureOrVerifyOption;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isSubmitting;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool showErrorMessages;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyFormState(registrationToken: $registrationToken, otpCode: $otpCode, failureOrVerifyOption: $failureOrVerifyOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$VerifyFormStateImpl &&
|
||||||
|
(identical(other.registrationToken, registrationToken) ||
|
||||||
|
other.registrationToken == registrationToken) &&
|
||||||
|
(identical(other.otpCode, otpCode) || other.otpCode == otpCode) &&
|
||||||
|
(identical(other.failureOrVerifyOption, failureOrVerifyOption) ||
|
||||||
|
other.failureOrVerifyOption == failureOrVerifyOption) &&
|
||||||
|
(identical(other.isSubmitting, isSubmitting) ||
|
||||||
|
other.isSubmitting == isSubmitting) &&
|
||||||
|
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||||
|
other.showErrorMessages == showErrorMessages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
registrationToken,
|
||||||
|
otpCode,
|
||||||
|
failureOrVerifyOption,
|
||||||
|
isSubmitting,
|
||||||
|
showErrorMessages,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$VerifyFormStateImplCopyWith<_$VerifyFormStateImpl> get copyWith =>
|
||||||
|
__$$VerifyFormStateImplCopyWithImpl<_$VerifyFormStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _VerifyFormState implements VerifyFormState {
|
||||||
|
const factory _VerifyFormState({
|
||||||
|
required final String registrationToken,
|
||||||
|
required final String otpCode,
|
||||||
|
required final Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||||
|
final bool isSubmitting,
|
||||||
|
final bool showErrorMessages,
|
||||||
|
}) = _$VerifyFormStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get registrationToken;
|
||||||
|
@override
|
||||||
|
String get otpCode;
|
||||||
|
@override
|
||||||
|
Option<Either<AuthFailure, Verify>> get failureOrVerifyOption;
|
||||||
|
@override
|
||||||
|
bool get isSubmitting;
|
||||||
|
@override
|
||||||
|
bool get showErrorMessages;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyFormState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$VerifyFormStateImplCopyWith<_$VerifyFormStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
part of 'verify_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class VerifyFormEvent with _$VerifyFormEvent {
|
||||||
|
const factory VerifyFormEvent.registrationTokenChanged(
|
||||||
|
String registrationToken,
|
||||||
|
) = _RegistrationTokenChanged;
|
||||||
|
const factory VerifyFormEvent.otpCodeChanged(String otpCode) =
|
||||||
|
_OtpCodeChanged;
|
||||||
|
const factory VerifyFormEvent.submitted() = _Submitted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
part of 'verify_form_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class VerifyFormState with _$VerifyFormState {
|
||||||
|
const factory VerifyFormState({
|
||||||
|
required String registrationToken,
|
||||||
|
required String otpCode,
|
||||||
|
required Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||||
|
@Default(false) bool isSubmitting,
|
||||||
|
@Default(false) bool showErrorMessages,
|
||||||
|
}) = _VerifyFormState;
|
||||||
|
|
||||||
|
factory VerifyFormState.initial() => VerifyFormState(
|
||||||
|
registrationToken: '',
|
||||||
|
otpCode: '',
|
||||||
|
failureOrVerifyOption: none(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/customer/customer.dart';
|
||||||
|
|
||||||
|
part 'customer_point_loader_event.dart';
|
||||||
|
part 'customer_point_loader_state.dart';
|
||||||
|
part 'customer_point_loader_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class CustomerPointLoaderBloc
|
||||||
|
extends Bloc<CustomerPointLoaderEvent, CustomerPointLoaderState> {
|
||||||
|
final ICustomerRepository _repository;
|
||||||
|
CustomerPointLoaderBloc(this._repository)
|
||||||
|
: super(CustomerPointLoaderState.initial()) {
|
||||||
|
on<CustomerPointLoaderEvent>(_onCustomerPointLoaderEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onCustomerPointLoaderEvent(
|
||||||
|
CustomerPointLoaderEvent event,
|
||||||
|
Emitter<CustomerPointLoaderState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
fetched: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(isFetching: true, failureOptionCustomerPoint: none()),
|
||||||
|
);
|
||||||
|
|
||||||
|
final result = await _repository.getPoints();
|
||||||
|
|
||||||
|
var data = result.fold(
|
||||||
|
(f) => state.copyWith(failureOptionCustomerPoint: optionOf(f)),
|
||||||
|
(customerPoint) => state.copyWith(customerPoint: customerPoint),
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(data.copyWith(isFetching: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+391
@@ -0,0 +1,391 @@
|
|||||||
|
// 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 'customer_point_loader_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 _$CustomerPointLoaderEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CustomerPointLoaderEventCopyWith<$Res> {
|
||||||
|
factory $CustomerPointLoaderEventCopyWith(
|
||||||
|
CustomerPointLoaderEvent value,
|
||||||
|
$Res Function(CustomerPointLoaderEvent) then,
|
||||||
|
) = _$CustomerPointLoaderEventCopyWithImpl<$Res, CustomerPointLoaderEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CustomerPointLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends CustomerPointLoaderEvent
|
||||||
|
>
|
||||||
|
implements $CustomerPointLoaderEventCopyWith<$Res> {
|
||||||
|
_$CustomerPointLoaderEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
|
factory _$$FetchedImplCopyWith(
|
||||||
|
_$FetchedImpl value,
|
||||||
|
$Res Function(_$FetchedImpl) then,
|
||||||
|
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FetchedImplCopyWithImpl<$Res>
|
||||||
|
extends _$CustomerPointLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||||
|
implements _$$FetchedImplCopyWith<$Res> {
|
||||||
|
__$$FetchedImplCopyWithImpl(
|
||||||
|
_$FetchedImpl _value,
|
||||||
|
$Res Function(_$FetchedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FetchedImpl implements _Fetched {
|
||||||
|
const _$FetchedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CustomerPointLoaderEvent.fetched()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
||||||
|
return fetched?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return fetched?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Fetched implements CustomerPointLoaderEvent {
|
||||||
|
const factory _Fetched() = _$FetchedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CustomerPointLoaderState {
|
||||||
|
CustomerPoint get customerPoint => throw _privateConstructorUsedError;
|
||||||
|
Option<CustomerFailure> get failureOptionCustomerPoint =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CustomerPointLoaderStateCopyWith<CustomerPointLoaderState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CustomerPointLoaderStateCopyWith<$Res> {
|
||||||
|
factory $CustomerPointLoaderStateCopyWith(
|
||||||
|
CustomerPointLoaderState value,
|
||||||
|
$Res Function(CustomerPointLoaderState) then,
|
||||||
|
) = _$CustomerPointLoaderStateCopyWithImpl<$Res, CustomerPointLoaderState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
CustomerPoint customerPoint,
|
||||||
|
Option<CustomerFailure> failureOptionCustomerPoint,
|
||||||
|
bool isFetching,
|
||||||
|
});
|
||||||
|
|
||||||
|
$CustomerPointCopyWith<$Res> get customerPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CustomerPointLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends CustomerPointLoaderState
|
||||||
|
>
|
||||||
|
implements $CustomerPointLoaderStateCopyWith<$Res> {
|
||||||
|
_$CustomerPointLoaderStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? customerPoint = null,
|
||||||
|
Object? failureOptionCustomerPoint = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
customerPoint: null == customerPoint
|
||||||
|
? _value.customerPoint
|
||||||
|
: customerPoint // ignore: cast_nullable_to_non_nullable
|
||||||
|
as CustomerPoint,
|
||||||
|
failureOptionCustomerPoint: null == failureOptionCustomerPoint
|
||||||
|
? _value.failureOptionCustomerPoint
|
||||||
|
: failureOptionCustomerPoint // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<CustomerFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$CustomerPointCopyWith<$Res> get customerPoint {
|
||||||
|
return $CustomerPointCopyWith<$Res>(_value.customerPoint, (value) {
|
||||||
|
return _then(_value.copyWith(customerPoint: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CustomerPointLoaderStateImplCopyWith<$Res>
|
||||||
|
implements $CustomerPointLoaderStateCopyWith<$Res> {
|
||||||
|
factory _$$CustomerPointLoaderStateImplCopyWith(
|
||||||
|
_$CustomerPointLoaderStateImpl value,
|
||||||
|
$Res Function(_$CustomerPointLoaderStateImpl) then,
|
||||||
|
) = __$$CustomerPointLoaderStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
CustomerPoint customerPoint,
|
||||||
|
Option<CustomerFailure> failureOptionCustomerPoint,
|
||||||
|
bool isFetching,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$CustomerPointCopyWith<$Res> get customerPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CustomerPointLoaderStateImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$CustomerPointLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
_$CustomerPointLoaderStateImpl
|
||||||
|
>
|
||||||
|
implements _$$CustomerPointLoaderStateImplCopyWith<$Res> {
|
||||||
|
__$$CustomerPointLoaderStateImplCopyWithImpl(
|
||||||
|
_$CustomerPointLoaderStateImpl _value,
|
||||||
|
$Res Function(_$CustomerPointLoaderStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? customerPoint = null,
|
||||||
|
Object? failureOptionCustomerPoint = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$CustomerPointLoaderStateImpl(
|
||||||
|
customerPoint: null == customerPoint
|
||||||
|
? _value.customerPoint
|
||||||
|
: customerPoint // ignore: cast_nullable_to_non_nullable
|
||||||
|
as CustomerPoint,
|
||||||
|
failureOptionCustomerPoint: null == failureOptionCustomerPoint
|
||||||
|
? _value.failureOptionCustomerPoint
|
||||||
|
: failureOptionCustomerPoint // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<CustomerFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$CustomerPointLoaderStateImpl implements _CustomerPointLoaderState {
|
||||||
|
const _$CustomerPointLoaderStateImpl({
|
||||||
|
required this.customerPoint,
|
||||||
|
required this.failureOptionCustomerPoint,
|
||||||
|
this.isFetching = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final CustomerPoint customerPoint;
|
||||||
|
@override
|
||||||
|
final Option<CustomerFailure> failureOptionCustomerPoint;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isFetching;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CustomerPointLoaderState(customerPoint: $customerPoint, failureOptionCustomerPoint: $failureOptionCustomerPoint, isFetching: $isFetching)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CustomerPointLoaderStateImpl &&
|
||||||
|
(identical(other.customerPoint, customerPoint) ||
|
||||||
|
other.customerPoint == customerPoint) &&
|
||||||
|
(identical(
|
||||||
|
other.failureOptionCustomerPoint,
|
||||||
|
failureOptionCustomerPoint,
|
||||||
|
) ||
|
||||||
|
other.failureOptionCustomerPoint ==
|
||||||
|
failureOptionCustomerPoint) &&
|
||||||
|
(identical(other.isFetching, isFetching) ||
|
||||||
|
other.isFetching == isFetching));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
customerPoint,
|
||||||
|
failureOptionCustomerPoint,
|
||||||
|
isFetching,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CustomerPointLoaderStateImplCopyWith<_$CustomerPointLoaderStateImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$CustomerPointLoaderStateImplCopyWithImpl<
|
||||||
|
_$CustomerPointLoaderStateImpl
|
||||||
|
>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CustomerPointLoaderState implements CustomerPointLoaderState {
|
||||||
|
const factory _CustomerPointLoaderState({
|
||||||
|
required final CustomerPoint customerPoint,
|
||||||
|
required final Option<CustomerFailure> failureOptionCustomerPoint,
|
||||||
|
final bool isFetching,
|
||||||
|
}) = _$CustomerPointLoaderStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
CustomerPoint get customerPoint;
|
||||||
|
@override
|
||||||
|
Option<CustomerFailure> get failureOptionCustomerPoint;
|
||||||
|
@override
|
||||||
|
bool get isFetching;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CustomerPointLoaderStateImplCopyWith<_$CustomerPointLoaderStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
part of 'customer_point_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CustomerPointLoaderEvent with _$CustomerPointLoaderEvent {
|
||||||
|
const factory CustomerPointLoaderEvent.fetched() = _Fetched;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
part of 'customer_point_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CustomerPointLoaderState with _$CustomerPointLoaderState {
|
||||||
|
const factory CustomerPointLoaderState({
|
||||||
|
required CustomerPoint customerPoint,
|
||||||
|
required Option<CustomerFailure> failureOptionCustomerPoint,
|
||||||
|
@Default(false) bool isFetching,
|
||||||
|
}) = _CustomerPointLoaderState;
|
||||||
|
|
||||||
|
factory CustomerPointLoaderState.initial() => CustomerPointLoaderState(
|
||||||
|
customerPoint: CustomerPoint.empty(),
|
||||||
|
failureOptionCustomerPoint: none(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/game/game.dart';
|
||||||
|
|
||||||
|
part 'ferris_wheel_loader_event.dart';
|
||||||
|
part 'ferris_wheel_loader_state.dart';
|
||||||
|
part 'ferris_wheel_loader_bloc.freezed.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class FerrisWheelLoaderBloc
|
||||||
|
extends Bloc<FerrisWheelLoaderEvent, FerrisWheelLoaderState> {
|
||||||
|
final IGameRepository _repository;
|
||||||
|
FerrisWheelLoaderBloc(this._repository)
|
||||||
|
: super(FerrisWheelLoaderState.initial()) {
|
||||||
|
on<FerrisWheelLoaderEvent>(_onFerrisWheelLoaderEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onFerrisWheelLoaderEvent(
|
||||||
|
FerrisWheelLoaderEvent event,
|
||||||
|
Emitter<FerrisWheelLoaderState> emit,
|
||||||
|
) {
|
||||||
|
return event.map(
|
||||||
|
fetched: (e) async {
|
||||||
|
emit(
|
||||||
|
state.copyWith(isFetching: true, failureOptionFerrisWheel: none()),
|
||||||
|
);
|
||||||
|
|
||||||
|
final result = await _repository.ferrisWheel();
|
||||||
|
|
||||||
|
var data = result.fold(
|
||||||
|
(f) => state.copyWith(failureOptionFerrisWheel: optionOf(f)),
|
||||||
|
(ferrisWheel) => state.copyWith(ferrisWheel: ferrisWheel),
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(data.copyWith(isFetching: false));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,388 @@
|
|||||||
|
// 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 'ferris_wheel_loader_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 _$FerrisWheelLoaderEvent {
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $FerrisWheelLoaderEventCopyWith<$Res> {
|
||||||
|
factory $FerrisWheelLoaderEventCopyWith(
|
||||||
|
FerrisWheelLoaderEvent value,
|
||||||
|
$Res Function(FerrisWheelLoaderEvent) then,
|
||||||
|
) = _$FerrisWheelLoaderEventCopyWithImpl<$Res, FerrisWheelLoaderEvent>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$FerrisWheelLoaderEventCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends FerrisWheelLoaderEvent
|
||||||
|
>
|
||||||
|
implements $FerrisWheelLoaderEventCopyWith<$Res> {
|
||||||
|
_$FerrisWheelLoaderEventCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
|
factory _$$FetchedImplCopyWith(
|
||||||
|
_$FetchedImpl value,
|
||||||
|
$Res Function(_$FetchedImpl) then,
|
||||||
|
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FetchedImplCopyWithImpl<$Res>
|
||||||
|
extends _$FerrisWheelLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||||
|
implements _$$FetchedImplCopyWith<$Res> {
|
||||||
|
__$$FetchedImplCopyWithImpl(
|
||||||
|
_$FetchedImpl _value,
|
||||||
|
$Res Function(_$FetchedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FetchedImpl implements _Fetched {
|
||||||
|
const _$FetchedImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'FerrisWheelLoaderEvent.fetched()';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => runtimeType.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
||||||
|
return fetched?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched();
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return fetched?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (fetched != null) {
|
||||||
|
return fetched(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Fetched implements FerrisWheelLoaderEvent {
|
||||||
|
const factory _Fetched() = _$FetchedImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$FerrisWheelLoaderState {
|
||||||
|
Game get ferrisWheel => throw _privateConstructorUsedError;
|
||||||
|
Option<GameFailure> get failureOptionFerrisWheel =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$FerrisWheelLoaderStateCopyWith<FerrisWheelLoaderState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $FerrisWheelLoaderStateCopyWith<$Res> {
|
||||||
|
factory $FerrisWheelLoaderStateCopyWith(
|
||||||
|
FerrisWheelLoaderState value,
|
||||||
|
$Res Function(FerrisWheelLoaderState) then,
|
||||||
|
) = _$FerrisWheelLoaderStateCopyWithImpl<$Res, FerrisWheelLoaderState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
Game ferrisWheel,
|
||||||
|
Option<GameFailure> failureOptionFerrisWheel,
|
||||||
|
bool isFetching,
|
||||||
|
});
|
||||||
|
|
||||||
|
$GameCopyWith<$Res> get ferrisWheel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$FerrisWheelLoaderStateCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends FerrisWheelLoaderState
|
||||||
|
>
|
||||||
|
implements $FerrisWheelLoaderStateCopyWith<$Res> {
|
||||||
|
_$FerrisWheelLoaderStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? ferrisWheel = null,
|
||||||
|
Object? failureOptionFerrisWheel = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
ferrisWheel: null == ferrisWheel
|
||||||
|
? _value.ferrisWheel
|
||||||
|
: ferrisWheel // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Game,
|
||||||
|
failureOptionFerrisWheel: null == failureOptionFerrisWheel
|
||||||
|
? _value.failureOptionFerrisWheel
|
||||||
|
: failureOptionFerrisWheel // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<GameFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GameCopyWith<$Res> get ferrisWheel {
|
||||||
|
return $GameCopyWith<$Res>(_value.ferrisWheel, (value) {
|
||||||
|
return _then(_value.copyWith(ferrisWheel: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$FerrisWheelLoaderStateImplCopyWith<$Res>
|
||||||
|
implements $FerrisWheelLoaderStateCopyWith<$Res> {
|
||||||
|
factory _$$FerrisWheelLoaderStateImplCopyWith(
|
||||||
|
_$FerrisWheelLoaderStateImpl value,
|
||||||
|
$Res Function(_$FerrisWheelLoaderStateImpl) then,
|
||||||
|
) = __$$FerrisWheelLoaderStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
Game ferrisWheel,
|
||||||
|
Option<GameFailure> failureOptionFerrisWheel,
|
||||||
|
bool isFetching,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$GameCopyWith<$Res> get ferrisWheel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$FerrisWheelLoaderStateImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$FerrisWheelLoaderStateCopyWithImpl<$Res, _$FerrisWheelLoaderStateImpl>
|
||||||
|
implements _$$FerrisWheelLoaderStateImplCopyWith<$Res> {
|
||||||
|
__$$FerrisWheelLoaderStateImplCopyWithImpl(
|
||||||
|
_$FerrisWheelLoaderStateImpl _value,
|
||||||
|
$Res Function(_$FerrisWheelLoaderStateImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? ferrisWheel = null,
|
||||||
|
Object? failureOptionFerrisWheel = null,
|
||||||
|
Object? isFetching = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$FerrisWheelLoaderStateImpl(
|
||||||
|
ferrisWheel: null == ferrisWheel
|
||||||
|
? _value.ferrisWheel
|
||||||
|
: ferrisWheel // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Game,
|
||||||
|
failureOptionFerrisWheel: null == failureOptionFerrisWheel
|
||||||
|
? _value.failureOptionFerrisWheel
|
||||||
|
: failureOptionFerrisWheel // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<GameFailure>,
|
||||||
|
isFetching: null == isFetching
|
||||||
|
? _value.isFetching
|
||||||
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$FerrisWheelLoaderStateImpl implements _FerrisWheelLoaderState {
|
||||||
|
const _$FerrisWheelLoaderStateImpl({
|
||||||
|
required this.ferrisWheel,
|
||||||
|
required this.failureOptionFerrisWheel,
|
||||||
|
this.isFetching = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final Game ferrisWheel;
|
||||||
|
@override
|
||||||
|
final Option<GameFailure> failureOptionFerrisWheel;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isFetching;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'FerrisWheelLoaderState(ferrisWheel: $ferrisWheel, failureOptionFerrisWheel: $failureOptionFerrisWheel, isFetching: $isFetching)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$FerrisWheelLoaderStateImpl &&
|
||||||
|
(identical(other.ferrisWheel, ferrisWheel) ||
|
||||||
|
other.ferrisWheel == ferrisWheel) &&
|
||||||
|
(identical(
|
||||||
|
other.failureOptionFerrisWheel,
|
||||||
|
failureOptionFerrisWheel,
|
||||||
|
) ||
|
||||||
|
other.failureOptionFerrisWheel == failureOptionFerrisWheel) &&
|
||||||
|
(identical(other.isFetching, isFetching) ||
|
||||||
|
other.isFetching == isFetching));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
ferrisWheel,
|
||||||
|
failureOptionFerrisWheel,
|
||||||
|
isFetching,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$FerrisWheelLoaderStateImplCopyWith<_$FerrisWheelLoaderStateImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$FerrisWheelLoaderStateImplCopyWithImpl<_$FerrisWheelLoaderStateImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _FerrisWheelLoaderState implements FerrisWheelLoaderState {
|
||||||
|
const factory _FerrisWheelLoaderState({
|
||||||
|
required final Game ferrisWheel,
|
||||||
|
required final Option<GameFailure> failureOptionFerrisWheel,
|
||||||
|
final bool isFetching,
|
||||||
|
}) = _$FerrisWheelLoaderStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Game get ferrisWheel;
|
||||||
|
@override
|
||||||
|
Option<GameFailure> get failureOptionFerrisWheel;
|
||||||
|
@override
|
||||||
|
bool get isFetching;
|
||||||
|
|
||||||
|
/// Create a copy of FerrisWheelLoaderState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$FerrisWheelLoaderStateImplCopyWith<_$FerrisWheelLoaderStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
part of 'ferris_wheel_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class FerrisWheelLoaderEvent with _$FerrisWheelLoaderEvent {
|
||||||
|
const factory FerrisWheelLoaderEvent.fetched() = _Fetched;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
part of 'ferris_wheel_loader_bloc.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class FerrisWheelLoaderState with _$FerrisWheelLoaderState {
|
||||||
|
const factory FerrisWheelLoaderState({
|
||||||
|
required Game ferrisWheel,
|
||||||
|
required Option<GameFailure> failureOptionFerrisWheel,
|
||||||
|
@Default(false) bool isFetching,
|
||||||
|
}) = _FerrisWheelLoaderState;
|
||||||
|
|
||||||
|
factory FerrisWheelLoaderState.initial() => FerrisWheelLoaderState(
|
||||||
|
ferrisWheel: Game.empty(),
|
||||||
|
failureOptionFerrisWheel: none(),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ class ApiClient {
|
|||||||
ApiClient(this._dio, this._env) {
|
ApiClient(this._dio, this._env) {
|
||||||
_dio.options.baseUrl = _env.baseUrl;
|
_dio.options.baseUrl = _env.baseUrl;
|
||||||
_dio.options.connectTimeout = const Duration(seconds: 20);
|
_dio.options.connectTimeout = const Duration(seconds: 20);
|
||||||
|
_dio.options.validateStatus = (status) => true;
|
||||||
_dio.interceptors.add(BadNetworkErrorInterceptor());
|
_dio.interceptors.add(BadNetworkErrorInterceptor());
|
||||||
_dio.interceptors.add(BadRequestErrorInterceptor());
|
_dio.interceptors.add(BadRequestErrorInterceptor());
|
||||||
_dio.interceptors.add(InternalServerErrorInterceptor());
|
_dio.interceptors.add(InternalServerErrorInterceptor());
|
||||||
|
|||||||
@@ -1,15 +1,40 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../../../presentation/router/app_router.gr.dart';
|
||||||
|
import '../../constant/local_storage_key.dart';
|
||||||
import '../errors/unauthorized_error.dart';
|
import '../errors/unauthorized_error.dart';
|
||||||
|
|
||||||
class UnauthorizedInterceptor extends Interceptor {
|
class UnauthorizedInterceptor extends Interceptor {
|
||||||
|
static final GlobalKey<NavigatorState> navigatorKey =
|
||||||
|
GlobalKey<NavigatorState>();
|
||||||
@override
|
@override
|
||||||
void onError(DioException err, ErrorInterceptorHandler handler) {
|
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||||
if (err.response?.statusCode == 401 ||
|
if (err.response?.statusCode == 401 ||
|
||||||
err.response?.statusCode == 403 ||
|
err.response?.statusCode == 403 ||
|
||||||
err.response?.statusCode == 419) {
|
err.response?.statusCode == 419) {
|
||||||
|
await _handleTokenExpired();
|
||||||
return super.onError(UnauthorizedError(err, null), handler);
|
return super.onError(UnauthorizedError(err, null), handler);
|
||||||
}
|
}
|
||||||
super.onError(err, handler);
|
super.onError(err, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _handleTokenExpired() async {
|
||||||
|
// Clear stored token
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.remove(LocalStorageKey.token);
|
||||||
|
await prefs.remove(LocalStorageKey.user);
|
||||||
|
await prefs.clear(); // Optional: clear all user data
|
||||||
|
log('handleTokenExpired');
|
||||||
|
// Navigate to login page
|
||||||
|
final context = navigatorKey.currentContext;
|
||||||
|
if (context != null) {
|
||||||
|
// Option 1: Navigate and remove all previous routes
|
||||||
|
context.router.replaceAll([LoginRoute()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
import '../../sample/sample_data.dart';
|
||||||
|
|
||||||
class AppConstant {
|
class AppConstant {
|
||||||
static const String appName = "";
|
static const String appName = "Enaklo";
|
||||||
|
static const String coinName = "EnakCoin";
|
||||||
|
static const String poinName = "EnakPoin";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MerchantModel merchant = merchants.first;
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class LocalStorageKey {
|
||||||
|
static const token = 'token';
|
||||||
|
static const user = 'user';
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import '../../presentation/components/assets/assets.gen.dart';
|
||||||
|
|
||||||
|
class Service {
|
||||||
|
Service({
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
required this.imagePath,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String name;
|
||||||
|
final String imagePath;
|
||||||
|
final String description;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Service> services = [
|
||||||
|
Service(
|
||||||
|
name: 'Dine In',
|
||||||
|
description: 'Makan langsung di tempat',
|
||||||
|
imagePath: Assets.icons.dineIn.path,
|
||||||
|
),
|
||||||
|
Service(
|
||||||
|
name: 'Take Away',
|
||||||
|
description: 'Pesan dan bawa pulang',
|
||||||
|
imagePath: Assets.icons.takeaway.path,
|
||||||
|
),
|
||||||
|
];
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
part of 'extension.dart';
|
||||||
|
|
||||||
|
extension DoubleExt on double {
|
||||||
|
String get currencyFormatRpV2 => NumberFormat.currency(
|
||||||
|
locale: 'id',
|
||||||
|
symbol: 'Rp ',
|
||||||
|
decimalDigits: 0,
|
||||||
|
).format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension StringX on String {
|
||||||
|
String get currencyFormatRp {
|
||||||
|
final parsedValue = int.tryParse(this) ?? 0;
|
||||||
|
return NumberFormat.currency(
|
||||||
|
locale: 'id',
|
||||||
|
symbol: 'Rp ',
|
||||||
|
decimalDigits: 0,
|
||||||
|
).format(parsedValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension IntegerExt on int {
|
||||||
|
String get currencyFormatRp => NumberFormat.currency(
|
||||||
|
locale: 'id',
|
||||||
|
symbol: 'Rp ',
|
||||||
|
decimalDigits: 0,
|
||||||
|
).format(this);
|
||||||
|
}
|
||||||
@@ -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('yyyy-MM-dd', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format jam: 14:30
|
||||||
|
String get toHourMinute {
|
||||||
|
return DateFormat('HH:mm', 'id_ID').format(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,30 @@
|
|||||||
// TODO: define your code
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import '../../domain/auth/auth.dart';
|
||||||
|
|
||||||
|
part 'date_extension.dart';
|
||||||
|
part 'currency_extension.dart';
|
||||||
|
|
||||||
|
extension StringExt on String {
|
||||||
|
CheckPhoneStatus toCheckPhoneStatus() {
|
||||||
|
switch (this) {
|
||||||
|
case 'NOT_REGISTERED':
|
||||||
|
return CheckPhoneStatus.notRegistered;
|
||||||
|
case 'PASSWORD_REQUIRED':
|
||||||
|
return CheckPhoneStatus.passwordRequired;
|
||||||
|
default:
|
||||||
|
return CheckPhoneStatus.unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ResendStatus toResendStatus() {
|
||||||
|
switch (this) {
|
||||||
|
case 'RESEND_NOT_ALLOWED':
|
||||||
|
return ResendStatus.resendNotAllowed;
|
||||||
|
case 'SUCCESS':
|
||||||
|
return ResendStatus.success;
|
||||||
|
default:
|
||||||
|
return ResendStatus.unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../../injection.dart';
|
||||||
|
import '../constant/local_storage_key.dart';
|
||||||
|
|
||||||
void dismissKeyboard(BuildContext context) {
|
void dismissKeyboard(BuildContext context) {
|
||||||
final currentFocus = FocusScope.of(context);
|
final currentFocus = FocusScope.of(context);
|
||||||
@@ -6,3 +10,17 @@ void dismissKeyboard(BuildContext context) {
|
|||||||
FocusManager.instance.primaryFocus?.unfocus();
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getNormalizePhone(String phoneNumber) {
|
||||||
|
final normalizedPhone = phoneNumber.startsWith('08')
|
||||||
|
? phoneNumber.replaceFirst('0', '')
|
||||||
|
: phoneNumber;
|
||||||
|
return '62$normalizedPhone';
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> getAuthorizationHeader() {
|
||||||
|
return {
|
||||||
|
'Authorization':
|
||||||
|
'Bearer ${getIt<SharedPreferences>().getString(LocalStorageKey.token)}',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
// wheel_painter.dart - Fixed implementation with consistent positioning
|
||||||
|
import 'dart:math' as math;
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../domain/game/game.dart';
|
||||||
|
|
||||||
|
class WheelPainter extends CustomPainter {
|
||||||
|
final List<GamePrize> gamePrizes;
|
||||||
|
final Color Function(GamePrize prize, int index) getPrizeColor;
|
||||||
|
|
||||||
|
WheelPainter({required this.gamePrizes, required this.getPrizeColor});
|
||||||
|
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
if (gamePrizes.isEmpty) return;
|
||||||
|
|
||||||
|
final center = Offset(size.width / 2, size.height / 2);
|
||||||
|
final radius = size.width / 2;
|
||||||
|
final sectionAngle = 2 * math.pi / gamePrizes.length;
|
||||||
|
|
||||||
|
// Draw outer white border
|
||||||
|
final outerBorderPaint = Paint()
|
||||||
|
..color = Colors.white
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
canvas.drawCircle(center, radius, outerBorderPaint);
|
||||||
|
|
||||||
|
// Draw blue border ring
|
||||||
|
final blueBorderPaint = Paint()
|
||||||
|
..color = const Color(0xFF3B82F6)
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
canvas.drawCircle(center, radius - 8, blueBorderPaint);
|
||||||
|
|
||||||
|
// Draw inner white circle
|
||||||
|
final innerWhitePaint = Paint()
|
||||||
|
..color = Colors.white
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
canvas.drawCircle(center, radius - 20, innerWhitePaint);
|
||||||
|
|
||||||
|
// Draw sections - KONSISTEN dengan logic spin
|
||||||
|
for (int i = 0; i < gamePrizes.length; i++) {
|
||||||
|
final prize = gamePrizes[i];
|
||||||
|
// Section 0 di top (-Ď€/2), section 1 di kanan atas, dst (clockwise)
|
||||||
|
final startAngle = (-math.pi / 2) + (i * sectionAngle);
|
||||||
|
|
||||||
|
// Section background
|
||||||
|
final sectionPaint = Paint()
|
||||||
|
..color = getPrizeColor(prize, i)
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
|
||||||
|
canvas.drawArc(
|
||||||
|
Rect.fromCircle(center: center, radius: radius - 22),
|
||||||
|
startAngle,
|
||||||
|
sectionAngle,
|
||||||
|
true,
|
||||||
|
sectionPaint,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Draw prize text
|
||||||
|
final textAngle = startAngle + sectionAngle / 2;
|
||||||
|
final textPosition = Offset(
|
||||||
|
center.dx + (radius - 80) * math.cos(textAngle),
|
||||||
|
center.dy + (radius - 80) * math.sin(textAngle),
|
||||||
|
);
|
||||||
|
|
||||||
|
canvas.save();
|
||||||
|
canvas.translate(textPosition.dx, textPosition.dy);
|
||||||
|
canvas.rotate(textAngle + math.pi / 2);
|
||||||
|
|
||||||
|
final textPainter = TextPainter(
|
||||||
|
text: TextSpan(
|
||||||
|
text: prize.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
);
|
||||||
|
textPainter.layout(maxWidth: 100);
|
||||||
|
textPainter.paint(
|
||||||
|
canvas,
|
||||||
|
Offset(-textPainter.width / 2, -textPainter.height / 2),
|
||||||
|
);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
// DEBUG: Draw section number
|
||||||
|
final numberPosition = Offset(
|
||||||
|
center.dx + (radius - 50) * math.cos(textAngle),
|
||||||
|
center.dy + (radius - 50) * math.sin(textAngle),
|
||||||
|
);
|
||||||
|
canvas.drawCircle(numberPosition, 15, Paint()..color = Colors.white);
|
||||||
|
final numberPainter = TextPainter(
|
||||||
|
text: TextSpan(
|
||||||
|
text: i.toString(),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
);
|
||||||
|
numberPainter.layout();
|
||||||
|
numberPainter.paint(
|
||||||
|
canvas,
|
||||||
|
Offset(
|
||||||
|
numberPosition.dx - numberPainter.width / 2,
|
||||||
|
numberPosition.dy - numberPainter.height / 2,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw white dots
|
||||||
|
final dotPaint = Paint()
|
||||||
|
..color = Colors.white
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
for (int i = 0; i < 24; i++) {
|
||||||
|
final dotAngle = (2 * math.pi / 24) * i;
|
||||||
|
final dotPosition = Offset(
|
||||||
|
center.dx + (radius - 14) * math.cos(dotAngle),
|
||||||
|
center.dy + (radius - 14) * math.sin(dotAngle),
|
||||||
|
);
|
||||||
|
canvas.drawCircle(dotPosition, 3, dotPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw section dividers
|
||||||
|
final dividerPaint = Paint()
|
||||||
|
..color = Colors.white
|
||||||
|
..style = PaintingStyle.stroke
|
||||||
|
..strokeWidth = 2;
|
||||||
|
for (int i = 0; i < gamePrizes.length; i++) {
|
||||||
|
final angle = (-math.pi / 2) + (i * sectionAngle);
|
||||||
|
final lineStart = Offset(
|
||||||
|
center.dx + (radius - 110) * math.cos(angle),
|
||||||
|
center.dy + (radius - 110) * math.sin(angle),
|
||||||
|
);
|
||||||
|
final lineEnd = Offset(
|
||||||
|
center.dx + (radius - 22) * math.cos(angle),
|
||||||
|
center.dy + (radius - 22) * math.sin(angle),
|
||||||
|
);
|
||||||
|
canvas.drawLine(lineStart, lineEnd, dividerPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
part of 'theme.dart';
|
part of 'theme.dart';
|
||||||
|
|
||||||
class AppValue {}
|
class AppValue {
|
||||||
|
static const double padding = 16;
|
||||||
|
static const double margin = 16;
|
||||||
|
static const double borderRadius = 12;
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,12 +16,34 @@ class ThemeApp {
|
|||||||
fontFamily: FontFamily.quicksand,
|
fontFamily: FontFamily.quicksand,
|
||||||
primaryColor: AppColor.primary,
|
primaryColor: AppColor.primary,
|
||||||
scaffoldBackgroundColor: AppColor.white,
|
scaffoldBackgroundColor: AppColor.white,
|
||||||
|
datePickerTheme: DatePickerThemeData(
|
||||||
|
backgroundColor: AppColor.white,
|
||||||
|
todayBackgroundColor: MaterialStateProperty.resolveWith<Color?>((states) {
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return AppColor.primary; // warna background tanggal terpilih
|
||||||
|
}
|
||||||
|
return null; // default
|
||||||
|
}),
|
||||||
|
todayBorder: BorderSide(color: AppColor.primary, width: 1),
|
||||||
|
dayBackgroundColor: MaterialStateProperty.resolveWith<Color?>((states) {
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return AppColor.primary; // warna background tanggal terpilih
|
||||||
|
}
|
||||||
|
return null; // default
|
||||||
|
}),
|
||||||
|
dayForegroundColor: MaterialStateProperty.resolveWith<Color?>((states) {
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return AppColor.white; // warna text tanggal terpilih
|
||||||
|
}
|
||||||
|
return null; // default
|
||||||
|
}),
|
||||||
|
),
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
backgroundColor: AppColor.white,
|
backgroundColor: AppColor.white,
|
||||||
foregroundColor: AppColor.textPrimary,
|
foregroundColor: AppColor.textPrimary,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
titleTextStyle: AppStyle.xl.copyWith(
|
titleTextStyle: AppStyle.xl.copyWith(
|
||||||
color: AppColor.primary,
|
color: AppColor.textPrimary,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
@@ -33,7 +55,18 @@ class ThemeApp {
|
|||||||
backgroundColor: AppColor.primary,
|
backgroundColor: AppColor.primary,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(AppValue.borderRadius),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
foregroundColor: AppColor.primary,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
side: BorderSide(color: AppColor.border),
|
||||||
|
borderRadius: BorderRadiusGeometry.circular(AppValue.borderRadius),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
@@ -61,5 +94,10 @@ class ThemeApp {
|
|||||||
backgroundColor: AppColor.white,
|
backgroundColor: AppColor.white,
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
),
|
),
|
||||||
|
tabBarTheme: TabBarThemeData(
|
||||||
|
indicatorColor: AppColor.primary,
|
||||||
|
labelColor: AppColor.primary,
|
||||||
|
unselectedLabelColor: AppColor.textSecondary,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
class ApiPath {
|
||||||
|
static String checkPhone = '/api/v1/customer-auth/check-phone';
|
||||||
|
static String register = '/api/v1/customer-auth/register/start';
|
||||||
|
static String verify = '/api/v1/customer-auth/register/verify-otp';
|
||||||
|
static String setPassword = '/api/v1/customer-auth/register/set-password';
|
||||||
|
static String login = '/api/v1/customer-auth/login';
|
||||||
|
static String resend = '/api/v1/customer-auth/resend-otp';
|
||||||
|
|
||||||
|
// Marketing
|
||||||
|
static String ferrisWheel = '/api/v1/customer/ferris-wheel';
|
||||||
|
|
||||||
|
// Customer
|
||||||
|
static String customerPoint = '/api/v1/customer/points';
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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 'entities/verify_entity.dart';
|
||||||
|
part 'entities/login_entity.dart';
|
||||||
|
part 'entities/resend_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ResendStatus { resendNotAllowed, success, unknown }
|
||||||
|
|
||||||
|
extension ResendStatusX on ResendStatus {
|
||||||
|
String toStringType() => switch (this) {
|
||||||
|
ResendStatus.resendNotAllowed => 'RESEND_NOT_ALLOWED',
|
||||||
|
ResendStatus.success => 'SUCCESS',
|
||||||
|
ResendStatus.unknown => '',
|
||||||
|
};
|
||||||
|
|
||||||
|
bool get isResendNotAllowed => this == ResendStatus.resendNotAllowed;
|
||||||
|
bool get isSuccess => this == ResendStatus.success;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CheckPhone with _$CheckPhone {
|
||||||
|
const factory CheckPhone({
|
||||||
|
required CheckPhoneStatus status,
|
||||||
|
required String message,
|
||||||
|
required String phoneNumber,
|
||||||
|
}) = _CheckPhone;
|
||||||
|
|
||||||
|
factory CheckPhone.empty() => CheckPhone(
|
||||||
|
status: CheckPhoneStatus.unknown,
|
||||||
|
message: '',
|
||||||
|
phoneNumber: '',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Login with _$Login {
|
||||||
|
const factory Login({
|
||||||
|
required String status,
|
||||||
|
required String message,
|
||||||
|
required String accessToken,
|
||||||
|
required String refreshToken,
|
||||||
|
required User user,
|
||||||
|
}) = _Login;
|
||||||
|
|
||||||
|
factory Login.empty() => Login(
|
||||||
|
status: '',
|
||||||
|
message: '',
|
||||||
|
accessToken: '',
|
||||||
|
refreshToken: '',
|
||||||
|
user: User.empty(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class User with _$User {
|
||||||
|
const factory User({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
required String phoneNumber,
|
||||||
|
required String birthDate,
|
||||||
|
}) = _User;
|
||||||
|
|
||||||
|
factory User.empty() =>
|
||||||
|
const User(id: '', name: '', phoneNumber: '', birthDate: '');
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Resend with _$Resend {
|
||||||
|
const factory Resend({
|
||||||
|
required ResendStatus status,
|
||||||
|
required String message,
|
||||||
|
required String otpToken,
|
||||||
|
required int expiresIn,
|
||||||
|
required int nextResendIn,
|
||||||
|
}) = _Resend;
|
||||||
|
|
||||||
|
factory Resend.empty() => Resend(
|
||||||
|
status: ResendStatus.unknown,
|
||||||
|
message: '',
|
||||||
|
otpToken: '',
|
||||||
|
expiresIn: 0,
|
||||||
|
nextResendIn: 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
part of '../auth.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Verify with _$Verify {
|
||||||
|
const factory Verify({
|
||||||
|
required String status,
|
||||||
|
required String message,
|
||||||
|
required String registrationToken,
|
||||||
|
}) = _Verify;
|
||||||
|
|
||||||
|
factory Verify.empty() =>
|
||||||
|
const Verify(status: '', message: '', registrationToken: '');
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, Verify>> verify({
|
||||||
|
required String registrationToken,
|
||||||
|
required String otpCode,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, Login>> setPassword({
|
||||||
|
required String registrationToken,
|
||||||
|
required String password,
|
||||||
|
required String confirmPassword,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, Login>> login({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String password,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, Resend>> resend({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String purpose,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<bool> hasToken();
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, User>> currentUser();
|
||||||
|
|
||||||
|
Future<Either<AuthFailure, Unit>> logout();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../common/api/api_failure.dart';
|
||||||
|
|
||||||
|
part 'customer.freezed.dart';
|
||||||
|
|
||||||
|
part 'entities/customer_point_entity.dart';
|
||||||
|
part 'failures/customer_failures.dart';
|
||||||
|
part 'repositories/i_customer_repository.dart';
|
||||||
@@ -0,0 +1,713 @@
|
|||||||
|
// 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 'customer.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 _$CustomerPoint {
|
||||||
|
String get status => throw _privateConstructorUsedError;
|
||||||
|
String get message => throw _privateConstructorUsedError;
|
||||||
|
int get totalPoints => throw _privateConstructorUsedError;
|
||||||
|
String get lastUpdated => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPoint
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CustomerPointCopyWith<CustomerPoint> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CustomerPointCopyWith<$Res> {
|
||||||
|
factory $CustomerPointCopyWith(
|
||||||
|
CustomerPoint value,
|
||||||
|
$Res Function(CustomerPoint) then,
|
||||||
|
) = _$CustomerPointCopyWithImpl<$Res, CustomerPoint>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String status,
|
||||||
|
String message,
|
||||||
|
int totalPoints,
|
||||||
|
String lastUpdated,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CustomerPointCopyWithImpl<$Res, $Val extends CustomerPoint>
|
||||||
|
implements $CustomerPointCopyWith<$Res> {
|
||||||
|
_$CustomerPointCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPoint
|
||||||
|
/// 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? totalPoints = null,
|
||||||
|
Object? lastUpdated = 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,
|
||||||
|
totalPoints: null == totalPoints
|
||||||
|
? _value.totalPoints
|
||||||
|
: totalPoints // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
lastUpdated: null == lastUpdated
|
||||||
|
? _value.lastUpdated
|
||||||
|
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CustomerPointImplCopyWith<$Res>
|
||||||
|
implements $CustomerPointCopyWith<$Res> {
|
||||||
|
factory _$$CustomerPointImplCopyWith(
|
||||||
|
_$CustomerPointImpl value,
|
||||||
|
$Res Function(_$CustomerPointImpl) then,
|
||||||
|
) = __$$CustomerPointImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String status,
|
||||||
|
String message,
|
||||||
|
int totalPoints,
|
||||||
|
String lastUpdated,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CustomerPointImplCopyWithImpl<$Res>
|
||||||
|
extends _$CustomerPointCopyWithImpl<$Res, _$CustomerPointImpl>
|
||||||
|
implements _$$CustomerPointImplCopyWith<$Res> {
|
||||||
|
__$$CustomerPointImplCopyWithImpl(
|
||||||
|
_$CustomerPointImpl _value,
|
||||||
|
$Res Function(_$CustomerPointImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPoint
|
||||||
|
/// 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? totalPoints = null,
|
||||||
|
Object? lastUpdated = null,
|
||||||
|
}) {
|
||||||
|
return _then(
|
||||||
|
_$CustomerPointImpl(
|
||||||
|
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,
|
||||||
|
totalPoints: null == totalPoints
|
||||||
|
? _value.totalPoints
|
||||||
|
: totalPoints // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
lastUpdated: null == lastUpdated
|
||||||
|
? _value.lastUpdated
|
||||||
|
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$CustomerPointImpl implements _CustomerPoint {
|
||||||
|
const _$CustomerPointImpl({
|
||||||
|
required this.status,
|
||||||
|
required this.message,
|
||||||
|
required this.totalPoints,
|
||||||
|
required this.lastUpdated,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String status;
|
||||||
|
@override
|
||||||
|
final String message;
|
||||||
|
@override
|
||||||
|
final int totalPoints;
|
||||||
|
@override
|
||||||
|
final String lastUpdated;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CustomerPoint(status: $status, message: $message, totalPoints: $totalPoints, lastUpdated: $lastUpdated)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CustomerPointImpl &&
|
||||||
|
(identical(other.status, status) || other.status == status) &&
|
||||||
|
(identical(other.message, message) || other.message == message) &&
|
||||||
|
(identical(other.totalPoints, totalPoints) ||
|
||||||
|
other.totalPoints == totalPoints) &&
|
||||||
|
(identical(other.lastUpdated, lastUpdated) ||
|
||||||
|
other.lastUpdated == lastUpdated));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, status, message, totalPoints, lastUpdated);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPoint
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CustomerPointImplCopyWith<_$CustomerPointImpl> get copyWith =>
|
||||||
|
__$$CustomerPointImplCopyWithImpl<_$CustomerPointImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CustomerPoint implements CustomerPoint {
|
||||||
|
const factory _CustomerPoint({
|
||||||
|
required final String status,
|
||||||
|
required final String message,
|
||||||
|
required final int totalPoints,
|
||||||
|
required final String lastUpdated,
|
||||||
|
}) = _$CustomerPointImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get status;
|
||||||
|
@override
|
||||||
|
String get message;
|
||||||
|
@override
|
||||||
|
int get totalPoints;
|
||||||
|
@override
|
||||||
|
String get lastUpdated;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPoint
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CustomerPointImplCopyWith<_$CustomerPointImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CustomerFailure {
|
||||||
|
@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 $CustomerFailureCopyWith<$Res> {
|
||||||
|
factory $CustomerFailureCopyWith(
|
||||||
|
CustomerFailure value,
|
||||||
|
$Res Function(CustomerFailure) then,
|
||||||
|
) = _$CustomerFailureCopyWithImpl<$Res, CustomerFailure>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CustomerFailureCopyWithImpl<$Res, $Val extends CustomerFailure>
|
||||||
|
implements $CustomerFailureCopyWith<$Res> {
|
||||||
|
_$CustomerFailureCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerFailure
|
||||||
|
/// 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 _$CustomerFailureCopyWithImpl<$Res, _$ServerErrorImpl>
|
||||||
|
implements _$$ServerErrorImplCopyWith<$Res> {
|
||||||
|
__$$ServerErrorImplCopyWithImpl(
|
||||||
|
_$ServerErrorImpl _value,
|
||||||
|
$Res Function(_$ServerErrorImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerFailure
|
||||||
|
/// 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 CustomerFailure
|
||||||
|
/// 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 'CustomerFailure.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 CustomerFailure
|
||||||
|
/// 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 CustomerFailure {
|
||||||
|
const factory _ServerError(final ApiFailure failure) = _$ServerErrorImpl;
|
||||||
|
|
||||||
|
ApiFailure get failure;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerFailure
|
||||||
|
/// 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 _$CustomerFailureCopyWithImpl<$Res, _$UnexpectedErrorImpl>
|
||||||
|
implements _$$UnexpectedErrorImplCopyWith<$Res> {
|
||||||
|
__$$UnexpectedErrorImplCopyWithImpl(
|
||||||
|
_$UnexpectedErrorImpl _value,
|
||||||
|
$Res Function(_$UnexpectedErrorImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$UnexpectedErrorImpl implements _UnexpectedError {
|
||||||
|
const _$UnexpectedErrorImpl();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CustomerFailure.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 CustomerFailure {
|
||||||
|
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 _$CustomerFailureCopyWithImpl<$Res, _$DynamicErrorMessageImpl>
|
||||||
|
implements _$$DynamicErrorMessageImplCopyWith<$Res> {
|
||||||
|
__$$DynamicErrorMessageImplCopyWithImpl(
|
||||||
|
_$DynamicErrorMessageImpl _value,
|
||||||
|
$Res Function(_$DynamicErrorMessageImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerFailure
|
||||||
|
/// 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 'CustomerFailure.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 CustomerFailure
|
||||||
|
/// 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 CustomerFailure {
|
||||||
|
const factory _DynamicErrorMessage(final String erroMessage) =
|
||||||
|
_$DynamicErrorMessageImpl;
|
||||||
|
|
||||||
|
String get erroMessage;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerFailure
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$DynamicErrorMessageImplCopyWith<_$DynamicErrorMessageImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
part of '../customer.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class CustomerPoint with _$CustomerPoint {
|
||||||
|
const factory CustomerPoint({
|
||||||
|
required String status,
|
||||||
|
required String message,
|
||||||
|
required int totalPoints,
|
||||||
|
required String lastUpdated,
|
||||||
|
}) = _CustomerPoint;
|
||||||
|
|
||||||
|
factory CustomerPoint.empty() => const CustomerPoint(
|
||||||
|
status: '',
|
||||||
|
message: '',
|
||||||
|
totalPoints: 0,
|
||||||
|
lastUpdated: '',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
part of '../customer.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class CustomerFailure with _$CustomerFailure {
|
||||||
|
const factory CustomerFailure.serverError(ApiFailure failure) = _ServerError;
|
||||||
|
const factory CustomerFailure.unexpectedError() = _UnexpectedError;
|
||||||
|
const factory CustomerFailure.dynamicErrorMessage(String erroMessage) =
|
||||||
|
_DynamicErrorMessage;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
part of '../customer.dart';
|
||||||
|
|
||||||
|
abstract class ICustomerRepository {
|
||||||
|
Future<Either<CustomerFailure, CustomerPoint>> getPoints();
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
part of '../game.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Game with _$Game {
|
||||||
|
const factory Game({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
required String type,
|
||||||
|
required bool isActive,
|
||||||
|
required Map<String, dynamic> metadata,
|
||||||
|
required List<GamePrize> prizes,
|
||||||
|
required String createdAt,
|
||||||
|
required String updatedAt,
|
||||||
|
}) = _Game;
|
||||||
|
|
||||||
|
factory Game.empty() => const Game(
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
isActive: false,
|
||||||
|
metadata: {},
|
||||||
|
prizes: [],
|
||||||
|
createdAt: '',
|
||||||
|
updatedAt: '',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
part of '../game.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class GamePrize with _$GamePrize {
|
||||||
|
const factory GamePrize({
|
||||||
|
required String id,
|
||||||
|
required String gameId,
|
||||||
|
required String name,
|
||||||
|
required Map<String, dynamic> metadata,
|
||||||
|
required String createdAt,
|
||||||
|
required String updatedAt,
|
||||||
|
}) = _GamePrize;
|
||||||
|
|
||||||
|
factory GamePrize.empty() => const GamePrize(
|
||||||
|
id: '',
|
||||||
|
gameId: '',
|
||||||
|
name: '',
|
||||||
|
metadata: {},
|
||||||
|
createdAt: '',
|
||||||
|
updatedAt: '',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
part of '../game.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class GameFailure with _$GameFailure {
|
||||||
|
const factory GameFailure.serverError(ApiFailure failure) = _ServerError;
|
||||||
|
const factory GameFailure.unexpectedError() = _UnexpectedError;
|
||||||
|
const factory GameFailure.dynamicErrorMessage(String erroMessage) =
|
||||||
|
_DynamicErrorMessage;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../common/api/api_failure.dart';
|
||||||
|
|
||||||
|
part 'game.freezed.dart';
|
||||||
|
|
||||||
|
part 'entity/game_entity.dart';
|
||||||
|
part 'entity/game_prize_entity.dart';
|
||||||
|
part 'failures/game_failure.dart';
|
||||||
|
part 'repositories/i_game_repository.dart';
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
|||||||
|
part of '../game.dart';
|
||||||
|
|
||||||
|
abstract class IGameRepository {
|
||||||
|
Future<Either<GameFailure, Game>> ferrisWheel();
|
||||||
|
}
|
||||||
+3
-2
@@ -9,12 +9,13 @@ 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
|
||||||
|
String get baseUrl => 'https://api-pos.apskel.id'; // 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://api-pos.apskel.id';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../common/extension/extension.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';
|
||||||
|
part 'dto/verify_dto.dart';
|
||||||
|
part 'dto/login_dto.dart';
|
||||||
|
part 'dto/resend_dto.dart';
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,165 @@
|
|||||||
|
// 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,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$VerifyDtoImpl _$$VerifyDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$VerifyDtoImpl(
|
||||||
|
status: json['status'] as String?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data: json['data'] == null
|
||||||
|
? null
|
||||||
|
: VerifyDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$VerifyDtoImplToJson(_$VerifyDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'status': instance.status,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$VerifyDataDtoImpl _$$VerifyDataDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$VerifyDataDtoImpl(
|
||||||
|
registrationToken: json['registration_token'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$VerifyDataDtoImplToJson(_$VerifyDataDtoImpl instance) =>
|
||||||
|
<String, dynamic>{'registration_token': instance.registrationToken};
|
||||||
|
|
||||||
|
_$LoginDtoImpl _$$LoginDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$LoginDtoImpl(
|
||||||
|
status: json['status'] as String?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data: json['data'] == null
|
||||||
|
? null
|
||||||
|
: LoginDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$LoginDtoImplToJson(_$LoginDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'status': instance.status,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$LoginDataDtoImpl _$$LoginDataDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$LoginDataDtoImpl(
|
||||||
|
accessToken: json['access_token'] as String?,
|
||||||
|
refreshToken: json['refresh_token'] as String?,
|
||||||
|
user: json['user'] == null
|
||||||
|
? null
|
||||||
|
: UserDto.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$LoginDataDtoImplToJson(_$LoginDataDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'access_token': instance.accessToken,
|
||||||
|
'refresh_token': instance.refreshToken,
|
||||||
|
'user': instance.user,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$UserDtoImpl _$$UserDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$UserDtoImpl(
|
||||||
|
id: json['id'] as String?,
|
||||||
|
name: json['name'] as String?,
|
||||||
|
phoneNumber: json['phone_number'] as String?,
|
||||||
|
birthDate: json['birth_date'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$UserDtoImplToJson(_$UserDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'name': instance.name,
|
||||||
|
'phone_number': instance.phoneNumber,
|
||||||
|
'birth_date': instance.birthDate,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ResendDtoImpl _$$ResendDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ResendDtoImpl(
|
||||||
|
status: json['status'] as String?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data: json['data'] == null
|
||||||
|
? null
|
||||||
|
: ResendDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ResendDtoImplToJson(_$ResendDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'status': instance.status,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ResendDataDtoImpl _$$ResendDataDtoImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ResendDataDtoImpl(
|
||||||
|
otpToken: json['otp_token'] as String?,
|
||||||
|
expiresIn: (json['expires_in'] as num?)?.toInt(),
|
||||||
|
nextResendIn: (json['next_resend_in'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ResendDataDtoImplToJson(_$ResendDataDtoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'otp_token': instance.otpToken,
|
||||||
|
'expires_in': instance.expiresIn,
|
||||||
|
'next_resend_in': instance.nextResendIn,
|
||||||
|
};
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../../../common/constant/local_storage_key.dart';
|
||||||
|
import '../../../domain/auth/auth.dart';
|
||||||
|
import '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@injectable
|
||||||
|
class AuthLocalDataProvider {
|
||||||
|
final SharedPreferences _sharedPreferences;
|
||||||
|
final String _logName = 'AuthLocalDataProvider';
|
||||||
|
|
||||||
|
AuthLocalDataProvider(this._sharedPreferences);
|
||||||
|
|
||||||
|
Future<void> saveToken(String token) async {
|
||||||
|
await _sharedPreferences.setString(LocalStorageKey.token, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String?> getToken() async {
|
||||||
|
return _sharedPreferences.getString(LocalStorageKey.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteToken() async {
|
||||||
|
await _sharedPreferences.remove(LocalStorageKey.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> hasToken() async {
|
||||||
|
return _sharedPreferences.containsKey(LocalStorageKey.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> saveCurrentUser(UserDto user) async {
|
||||||
|
final userJsonString = jsonEncode(user.toJson());
|
||||||
|
await _sharedPreferences.setString(LocalStorageKey.user, userJsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<User> currentUser() async {
|
||||||
|
final userString = _sharedPreferences.getString(LocalStorageKey.user);
|
||||||
|
if (userString == null) return User.empty();
|
||||||
|
|
||||||
|
final Map<String, dynamic> userMap = jsonDecode(userString);
|
||||||
|
final userDto = UserDto.fromJson(userMap);
|
||||||
|
return userDto.toDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteCurrentUser() async {
|
||||||
|
await _sharedPreferences.remove(LocalStorageKey.user);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteAllAuth() async {
|
||||||
|
try {
|
||||||
|
await _sharedPreferences.remove(LocalStorageKey.token);
|
||||||
|
await _sharedPreferences.remove(LocalStorageKey.user);
|
||||||
|
} catch (e) {
|
||||||
|
log('deleteAllAuthError', name: _logName, error: e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,265 @@
|
|||||||
|
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'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (response.data['errors'][0]['code'] == 304) {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
response.data['errors'][0]['cause'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AuthFailure, VerifyDto>> verify({
|
||||||
|
required String registrationToken,
|
||||||
|
required String otpCode,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.post(
|
||||||
|
ApiPath.verify,
|
||||||
|
data: {'registration_token': registrationToken, 'otp_code': otpCode},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['success'] == false) {
|
||||||
|
if ((response.data['errors'] as List).isNotEmpty) {
|
||||||
|
if (response.data['errors'][0]['code'] == "900") {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage('Kode OTP Tidak Sesuai'),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = VerifyDto.fromJson(response.data['data']);
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('verify', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AuthFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AuthFailure, LoginDto>> setPassword({
|
||||||
|
required String registrationToken,
|
||||||
|
required String password,
|
||||||
|
required String confirmPassword,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.post(
|
||||||
|
ApiPath.setPassword,
|
||||||
|
data: {
|
||||||
|
'registration_token': registrationToken,
|
||||||
|
'password': password,
|
||||||
|
'confirm_password': confirmPassword,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['success'] == false) {
|
||||||
|
if ((response.data['errors'] as List).isNotEmpty) {
|
||||||
|
if (response.data['errors'][0]['code'] == 900) {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Invalid Registration, Lakukan kembali dari awal',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (response.data['errors'][0]['code'] == "304") {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
response.data['errors'][0]['cause'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = LoginDto.fromJson(response.data['data']);
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('setPassword', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AuthFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AuthFailure, LoginDto>> login({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String password,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.post(
|
||||||
|
ApiPath.login,
|
||||||
|
data: {'phone_number': phoneNumber, 'password': password},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['success'] == false) {
|
||||||
|
if ((response.data['errors'] as List).isNotEmpty) {
|
||||||
|
if (response.data['errors'][0]['code'] == "900") {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
response.data['errors'][0]['cause'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage(
|
||||||
|
'Terjadi kesalahan coba lagi nanti',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = LoginDto.fromJson(response.data['data']);
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('login', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AuthFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DC<AuthFailure, ResendDto>> resend({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String purpose, //login or registration
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.post(
|
||||||
|
ApiPath.resend,
|
||||||
|
data: {'phone_number': phoneNumber, 'purpose': purpose},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.data['success'] == false) {
|
||||||
|
return DC.error(
|
||||||
|
AuthFailure.dynamicErrorMessage('Terjadi kesalahan coba lagi nanti'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final dto = ResendDto.fromJson(response.data['data']);
|
||||||
|
return DC.data(dto);
|
||||||
|
} on ApiFailure catch (e, s) {
|
||||||
|
log('resend', name: _logName, error: e, stackTrace: s);
|
||||||
|
return DC.error(AuthFailure.serverError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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?.toCheckPhoneStatus() ?? CheckPhoneStatus.unknown,
|
||||||
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
part of '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class LoginDto with _$LoginDto {
|
||||||
|
const factory LoginDto({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') LoginDataDto? data,
|
||||||
|
}) = _LoginDto;
|
||||||
|
|
||||||
|
factory LoginDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$LoginDtoFromJson(json);
|
||||||
|
|
||||||
|
const LoginDto._();
|
||||||
|
|
||||||
|
/// mapping ke domain
|
||||||
|
Login toDomain() => Login(
|
||||||
|
status: status ?? '',
|
||||||
|
message: message ?? '',
|
||||||
|
accessToken: data?.accessToken ?? '',
|
||||||
|
refreshToken: data?.refreshToken ?? '',
|
||||||
|
user: data?.user?.toDomain() ?? User.empty(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class LoginDataDto with _$LoginDataDto {
|
||||||
|
const factory LoginDataDto({
|
||||||
|
@JsonKey(name: 'access_token') String? accessToken,
|
||||||
|
@JsonKey(name: 'refresh_token') String? refreshToken,
|
||||||
|
@JsonKey(name: 'user') UserDto? user,
|
||||||
|
}) = _LoginDataDto;
|
||||||
|
|
||||||
|
factory LoginDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$LoginDataDtoFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class UserDto with _$UserDto {
|
||||||
|
const factory UserDto({
|
||||||
|
@JsonKey(name: 'id') String? id,
|
||||||
|
@JsonKey(name: 'name') String? name,
|
||||||
|
@JsonKey(name: 'phone_number') String? phoneNumber,
|
||||||
|
@JsonKey(name: 'birth_date') String? birthDate,
|
||||||
|
}) = _UserDto;
|
||||||
|
|
||||||
|
factory UserDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$UserDtoFromJson(json);
|
||||||
|
|
||||||
|
const UserDto._();
|
||||||
|
|
||||||
|
User toDomain() => User(
|
||||||
|
id: id ?? '',
|
||||||
|
name: name ?? '',
|
||||||
|
phoneNumber: phoneNumber ?? '',
|
||||||
|
birthDate: birthDate ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
part of '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ResendDto with _$ResendDto {
|
||||||
|
const factory ResendDto({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') ResendDataDto? data,
|
||||||
|
}) = _ResendDto;
|
||||||
|
|
||||||
|
factory ResendDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ResendDtoFromJson(json);
|
||||||
|
|
||||||
|
const ResendDto._();
|
||||||
|
|
||||||
|
/// mapping ke domain
|
||||||
|
Resend toDomain() => Resend(
|
||||||
|
status: status?.toResendStatus() ?? ResendStatus.unknown,
|
||||||
|
message: message ?? '',
|
||||||
|
otpToken: data?.otpToken ?? '',
|
||||||
|
expiresIn: data?.expiresIn ?? 0,
|
||||||
|
nextResendIn: data?.nextResendIn ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ResendDataDto with _$ResendDataDto {
|
||||||
|
const factory ResendDataDto({
|
||||||
|
@JsonKey(name: 'otp_token') String? otpToken,
|
||||||
|
@JsonKey(name: 'expires_in') int? expiresIn,
|
||||||
|
@JsonKey(name: 'next_resend_in') int? nextResendIn,
|
||||||
|
}) = _ResendDataDto;
|
||||||
|
|
||||||
|
factory ResendDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$ResendDataDtoFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
part of '../auth_dtos.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class VerifyDto with _$VerifyDto {
|
||||||
|
const factory VerifyDto({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') VerifyDataDto? data,
|
||||||
|
}) = _VerifyDto;
|
||||||
|
|
||||||
|
factory VerifyDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$VerifyDtoFromJson(json);
|
||||||
|
|
||||||
|
const VerifyDto._(); // biar bisa bikin method
|
||||||
|
|
||||||
|
/// mapping ke domain
|
||||||
|
Verify toDomain() => Verify(
|
||||||
|
status: status ?? '',
|
||||||
|
message: message ?? '',
|
||||||
|
registrationToken: data?.registrationToken ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class VerifyDataDto with _$VerifyDataDto {
|
||||||
|
const factory VerifyDataDto({
|
||||||
|
@JsonKey(name: 'registration_token') String? registrationToken,
|
||||||
|
}) = _VerifyDataDto;
|
||||||
|
|
||||||
|
factory VerifyDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$VerifyDataDtoFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:injectable/injectable.dart';
|
||||||
|
|
||||||
|
import '../../../domain/auth/auth.dart';
|
||||||
|
import '../datasources/local_data_provider.dart';
|
||||||
|
import '../datasources/remote_data_provider.dart';
|
||||||
|
|
||||||
|
@Injectable(as: IAuthRepository)
|
||||||
|
class AuthRepository implements IAuthRepository {
|
||||||
|
final AuthLocalDataProvider _localDataProvider;
|
||||||
|
final AuthRemoteDataProvider _remoteDataProvider;
|
||||||
|
|
||||||
|
final String _logName = 'AuthRepository';
|
||||||
|
|
||||||
|
AuthRepository(this._remoteDataProvider, this._localDataProvider);
|
||||||
|
|
||||||
|
@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('registerError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, Verify>> verify({
|
||||||
|
required String registrationToken,
|
||||||
|
required String otpCode,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final result = await _remoteDataProvider.verify(
|
||||||
|
registrationToken: registrationToken,
|
||||||
|
otpCode: otpCode,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.hasError) {
|
||||||
|
return left(result.error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
final auth = result.data!.toDomain();
|
||||||
|
|
||||||
|
return right(auth);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('verifyError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, Login>> setPassword({
|
||||||
|
required String registrationToken,
|
||||||
|
required String password,
|
||||||
|
required String confirmPassword,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final result = await _remoteDataProvider.setPassword(
|
||||||
|
registrationToken: registrationToken,
|
||||||
|
password: password,
|
||||||
|
confirmPassword: confirmPassword,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.hasError) {
|
||||||
|
return left(result.error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
final auth = result.data!.toDomain();
|
||||||
|
|
||||||
|
await _localDataProvider.saveToken(auth.accessToken);
|
||||||
|
await _localDataProvider.saveCurrentUser(result.data!.data!.user!);
|
||||||
|
|
||||||
|
return right(auth);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('setPasswordError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, Login>> login({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String password,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final result = await _remoteDataProvider.login(
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
password: password,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.hasError) {
|
||||||
|
return left(result.error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
final auth = result.data!.toDomain();
|
||||||
|
|
||||||
|
await _localDataProvider.saveToken(auth.accessToken);
|
||||||
|
await _localDataProvider.saveCurrentUser(result.data!.data!.user!);
|
||||||
|
|
||||||
|
return right(auth);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('loginError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, Resend>> resend({
|
||||||
|
required String phoneNumber,
|
||||||
|
required String purpose,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final result = await _remoteDataProvider.resend(
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
purpose: purpose,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.hasError) {
|
||||||
|
return left(result.error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
final auth = result.data!.toDomain();
|
||||||
|
|
||||||
|
return right(auth);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('resendError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, User>> currentUser() async {
|
||||||
|
try {
|
||||||
|
User user = await _localDataProvider.currentUser();
|
||||||
|
return right(user);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('currentUserError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> hasToken() async {
|
||||||
|
return await _localDataProvider.hasToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Either<AuthFailure, Unit>> logout() async {
|
||||||
|
try {
|
||||||
|
await _localDataProvider.deleteAllAuth();
|
||||||
|
return right(unit);
|
||||||
|
} catch (e, s) {
|
||||||
|
log('logoutError', name: _logName, error: e, stackTrace: s);
|
||||||
|
return left(const AuthFailure.unexpectedError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../domain/customer/customer.dart';
|
||||||
|
|
||||||
|
part 'customer_dtos.freezed.dart';
|
||||||
|
part 'customer_dtos.g.dart';
|
||||||
|
|
||||||
|
part 'dtos/customer_point_dto.dart';
|
||||||
@@ -0,0 +1,443 @@
|
|||||||
|
// 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 'customer_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',
|
||||||
|
);
|
||||||
|
|
||||||
|
CustomerPointDto _$CustomerPointDtoFromJson(Map<String, dynamic> json) {
|
||||||
|
return _CustomerPointDto.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CustomerPointDto {
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
String? get status => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
String? get message => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
CustomerPointDataDto? get data => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this CustomerPointDto to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CustomerPointDtoCopyWith<CustomerPointDto> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CustomerPointDtoCopyWith<$Res> {
|
||||||
|
factory $CustomerPointDtoCopyWith(
|
||||||
|
CustomerPointDto value,
|
||||||
|
$Res Function(CustomerPointDto) then,
|
||||||
|
) = _$CustomerPointDtoCopyWithImpl<$Res, CustomerPointDto>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') CustomerPointDataDto? data,
|
||||||
|
});
|
||||||
|
|
||||||
|
$CustomerPointDataDtoCopyWith<$Res>? get data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CustomerPointDtoCopyWithImpl<$Res, $Val extends CustomerPointDto>
|
||||||
|
implements $CustomerPointDtoCopyWith<$Res> {
|
||||||
|
_$CustomerPointDtoCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDto
|
||||||
|
/// 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 CustomerPointDataDto?,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$CustomerPointDataDtoCopyWith<$Res>? get data {
|
||||||
|
if (_value.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $CustomerPointDataDtoCopyWith<$Res>(_value.data!, (value) {
|
||||||
|
return _then(_value.copyWith(data: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CustomerPointDtoImplCopyWith<$Res>
|
||||||
|
implements $CustomerPointDtoCopyWith<$Res> {
|
||||||
|
factory _$$CustomerPointDtoImplCopyWith(
|
||||||
|
_$CustomerPointDtoImpl value,
|
||||||
|
$Res Function(_$CustomerPointDtoImpl) then,
|
||||||
|
) = __$$CustomerPointDtoImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'status') String? status,
|
||||||
|
@JsonKey(name: 'message') String? message,
|
||||||
|
@JsonKey(name: 'data') CustomerPointDataDto? data,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$CustomerPointDataDtoCopyWith<$Res>? get data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CustomerPointDtoImplCopyWithImpl<$Res>
|
||||||
|
extends _$CustomerPointDtoCopyWithImpl<$Res, _$CustomerPointDtoImpl>
|
||||||
|
implements _$$CustomerPointDtoImplCopyWith<$Res> {
|
||||||
|
__$$CustomerPointDtoImplCopyWithImpl(
|
||||||
|
_$CustomerPointDtoImpl _value,
|
||||||
|
$Res Function(_$CustomerPointDtoImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDto
|
||||||
|
/// 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(
|
||||||
|
_$CustomerPointDtoImpl(
|
||||||
|
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 CustomerPointDataDto?,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$CustomerPointDtoImpl extends _CustomerPointDto {
|
||||||
|
const _$CustomerPointDtoImpl({
|
||||||
|
@JsonKey(name: 'status') this.status,
|
||||||
|
@JsonKey(name: 'message') this.message,
|
||||||
|
@JsonKey(name: 'data') this.data,
|
||||||
|
}) : super._();
|
||||||
|
|
||||||
|
factory _$CustomerPointDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$CustomerPointDtoImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
final String? status;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
final String? message;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
final CustomerPointDataDto? data;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CustomerPointDto(status: $status, message: $message, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CustomerPointDtoImpl &&
|
||||||
|
(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 CustomerPointDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CustomerPointDtoImplCopyWith<_$CustomerPointDtoImpl> get copyWith =>
|
||||||
|
__$$CustomerPointDtoImplCopyWithImpl<_$CustomerPointDtoImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$CustomerPointDtoImplToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CustomerPointDto extends CustomerPointDto {
|
||||||
|
const factory _CustomerPointDto({
|
||||||
|
@JsonKey(name: 'status') final String? status,
|
||||||
|
@JsonKey(name: 'message') final String? message,
|
||||||
|
@JsonKey(name: 'data') final CustomerPointDataDto? data,
|
||||||
|
}) = _$CustomerPointDtoImpl;
|
||||||
|
const _CustomerPointDto._() : super._();
|
||||||
|
|
||||||
|
factory _CustomerPointDto.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$CustomerPointDtoImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'status')
|
||||||
|
String? get status;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'message')
|
||||||
|
String? get message;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'data')
|
||||||
|
CustomerPointDataDto? get data;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CustomerPointDtoImplCopyWith<_$CustomerPointDtoImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomerPointDataDto _$CustomerPointDataDtoFromJson(Map<String, dynamic> json) {
|
||||||
|
return _CustomerPointDataDto.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CustomerPointDataDto {
|
||||||
|
@JsonKey(name: 'total_points')
|
||||||
|
int? get totalPoints => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: 'last_updated')
|
||||||
|
String? get lastUpdated => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Serializes this CustomerPointDataDto to a JSON map.
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
$CustomerPointDataDtoCopyWith<CustomerPointDataDto> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $CustomerPointDataDtoCopyWith<$Res> {
|
||||||
|
factory $CustomerPointDataDtoCopyWith(
|
||||||
|
CustomerPointDataDto value,
|
||||||
|
$Res Function(CustomerPointDataDto) then,
|
||||||
|
) = _$CustomerPointDataDtoCopyWithImpl<$Res, CustomerPointDataDto>;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'total_points') int? totalPoints,
|
||||||
|
@JsonKey(name: 'last_updated') String? lastUpdated,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$CustomerPointDataDtoCopyWithImpl<
|
||||||
|
$Res,
|
||||||
|
$Val extends CustomerPointDataDto
|
||||||
|
>
|
||||||
|
implements $CustomerPointDataDtoCopyWith<$Res> {
|
||||||
|
_$CustomerPointDataDtoCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? totalPoints = freezed, Object? lastUpdated = freezed}) {
|
||||||
|
return _then(
|
||||||
|
_value.copyWith(
|
||||||
|
totalPoints: freezed == totalPoints
|
||||||
|
? _value.totalPoints
|
||||||
|
: totalPoints // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
lastUpdated: freezed == lastUpdated
|
||||||
|
? _value.lastUpdated
|
||||||
|
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
)
|
||||||
|
as $Val,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$CustomerPointDataDtoImplCopyWith<$Res>
|
||||||
|
implements $CustomerPointDataDtoCopyWith<$Res> {
|
||||||
|
factory _$$CustomerPointDataDtoImplCopyWith(
|
||||||
|
_$CustomerPointDataDtoImpl value,
|
||||||
|
$Res Function(_$CustomerPointDataDtoImpl) then,
|
||||||
|
) = __$$CustomerPointDataDtoImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'total_points') int? totalPoints,
|
||||||
|
@JsonKey(name: 'last_updated') String? lastUpdated,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$CustomerPointDataDtoImplCopyWithImpl<$Res>
|
||||||
|
extends _$CustomerPointDataDtoCopyWithImpl<$Res, _$CustomerPointDataDtoImpl>
|
||||||
|
implements _$$CustomerPointDataDtoImplCopyWith<$Res> {
|
||||||
|
__$$CustomerPointDataDtoImplCopyWithImpl(
|
||||||
|
_$CustomerPointDataDtoImpl _value,
|
||||||
|
$Res Function(_$CustomerPointDataDtoImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? totalPoints = freezed, Object? lastUpdated = freezed}) {
|
||||||
|
return _then(
|
||||||
|
_$CustomerPointDataDtoImpl(
|
||||||
|
totalPoints: freezed == totalPoints
|
||||||
|
? _value.totalPoints
|
||||||
|
: totalPoints // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
lastUpdated: freezed == lastUpdated
|
||||||
|
? _value.lastUpdated
|
||||||
|
: lastUpdated // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$CustomerPointDataDtoImpl implements _CustomerPointDataDto {
|
||||||
|
const _$CustomerPointDataDtoImpl({
|
||||||
|
@JsonKey(name: 'total_points') this.totalPoints,
|
||||||
|
@JsonKey(name: 'last_updated') this.lastUpdated,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory _$CustomerPointDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$CustomerPointDataDtoImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'total_points')
|
||||||
|
final int? totalPoints;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'last_updated')
|
||||||
|
final String? lastUpdated;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CustomerPointDataDto(totalPoints: $totalPoints, lastUpdated: $lastUpdated)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$CustomerPointDataDtoImpl &&
|
||||||
|
(identical(other.totalPoints, totalPoints) ||
|
||||||
|
other.totalPoints == totalPoints) &&
|
||||||
|
(identical(other.lastUpdated, lastUpdated) ||
|
||||||
|
other.lastUpdated == lastUpdated));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, totalPoints, lastUpdated);
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$CustomerPointDataDtoImplCopyWith<_$CustomerPointDataDtoImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$CustomerPointDataDtoImplCopyWithImpl<_$CustomerPointDataDtoImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$CustomerPointDataDtoImplToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _CustomerPointDataDto implements CustomerPointDataDto {
|
||||||
|
const factory _CustomerPointDataDto({
|
||||||
|
@JsonKey(name: 'total_points') final int? totalPoints,
|
||||||
|
@JsonKey(name: 'last_updated') final String? lastUpdated,
|
||||||
|
}) = _$CustomerPointDataDtoImpl;
|
||||||
|
|
||||||
|
factory _CustomerPointDataDto.fromJson(Map<String, dynamic> json) =
|
||||||
|
_$CustomerPointDataDtoImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'total_points')
|
||||||
|
int? get totalPoints;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: 'last_updated')
|
||||||
|
String? get lastUpdated;
|
||||||
|
|
||||||
|
/// Create a copy of CustomerPointDataDto
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$CustomerPointDataDtoImplCopyWith<_$CustomerPointDataDtoImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'customer_dtos.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$CustomerPointDtoImpl _$$CustomerPointDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$CustomerPointDtoImpl(
|
||||||
|
status: json['status'] as String?,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data: json['data'] == null
|
||||||
|
? null
|
||||||
|
: CustomerPointDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$CustomerPointDtoImplToJson(
|
||||||
|
_$CustomerPointDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'status': instance.status,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$CustomerPointDataDtoImpl _$$CustomerPointDataDtoImplFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _$CustomerPointDataDtoImpl(
|
||||||
|
totalPoints: (json['total_points'] as num?)?.toInt(),
|
||||||
|
lastUpdated: json['last_updated'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$CustomerPointDataDtoImplToJson(
|
||||||
|
_$CustomerPointDataDtoImpl instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total_points': instance.totalPoints,
|
||||||
|
'last_updated': instance.lastUpdated,
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user