EnakPoint & EnakCoin wallet, PIN, outlet, order, community, reward
- Wallet EnakPoint & EnakCoin: beranda, riwayat, saldo kedaluwarsa, kode bayar, tukar EnakCoin, transfer - PIN (buat, ganti, lupa), outlet, riwayat order, game spin - Halaman community, webview, coming soon, dan ikon menu beranda baru - Redesign Reward Saya: kartu tiket, filter chip, detail kode + QR - Hapus customer point loader, menu, dan checkout lama - Base URL ke enaklo-pos-api.altru.id Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5954510b93
commit
f5e3075205
@@ -0,0 +1,47 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/wallet/wallet.dart';
|
||||
|
||||
part 'wallet_loader_event.dart';
|
||||
part 'wallet_loader_state.dart';
|
||||
part 'wallet_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class WalletLoaderBloc extends Bloc<WalletLoaderEvent, WalletLoaderState> {
|
||||
final IWalletRepository _repository;
|
||||
|
||||
WalletLoaderBloc(this._repository) : super(WalletLoaderState.initial()) {
|
||||
on<WalletLoaderEvent>(_onWalletLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onWalletLoaderEvent(
|
||||
WalletLoaderEvent event,
|
||||
Emitter<WalletLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
fetched: (e) async {
|
||||
emit(state.copyWith(isFetching: true, failureOption: none()));
|
||||
|
||||
final result = await _repository.getWallet();
|
||||
|
||||
final data = result.fold(
|
||||
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||
(summary) => state.copyWith(summary: summary, hasLoaded: true),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
coinBalanceUpdated: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
summary: state.summary.copyWith(coinBalance: e.coinBalance),
|
||||
),
|
||||
);
|
||||
},
|
||||
cleared: (e) async => emit(WalletLoaderState.initial()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,610 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package
|
||||
// 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 'wallet_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$WalletLoaderEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletLoaderEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletLoaderEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $WalletLoaderEventCopyWith<$Res> {
|
||||
$WalletLoaderEventCopyWith(WalletLoaderEvent _, $Res Function(WalletLoaderEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [WalletLoaderEvent].
|
||||
extension WalletLoaderEventPatterns on WalletLoaderEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Fetched value)? fetched,TResult Function( _CoinBalanceUpdated value)? coinBalanceUpdated,TResult Function( _Cleared value)? cleared,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Fetched() when fetched != null:
|
||||
return fetched(_that);case _CoinBalanceUpdated() when coinBalanceUpdated != null:
|
||||
return coinBalanceUpdated(_that);case _Cleared() when cleared != null:
|
||||
return cleared(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Fetched value) fetched,required TResult Function( _CoinBalanceUpdated value) coinBalanceUpdated,required TResult Function( _Cleared value) cleared,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Fetched():
|
||||
return fetched(_that);case _CoinBalanceUpdated():
|
||||
return coinBalanceUpdated(_that);case _Cleared():
|
||||
return cleared(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Fetched value)? fetched,TResult? Function( _CoinBalanceUpdated value)? coinBalanceUpdated,TResult? Function( _Cleared value)? cleared,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Fetched() when fetched != null:
|
||||
return fetched(_that);case _CoinBalanceUpdated() when coinBalanceUpdated != null:
|
||||
return coinBalanceUpdated(_that);case _Cleared() when cleared != null:
|
||||
return cleared(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? fetched,TResult Function( int coinBalance)? coinBalanceUpdated,TResult Function()? cleared,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Fetched() when fetched != null:
|
||||
return fetched();case _CoinBalanceUpdated() when coinBalanceUpdated != null:
|
||||
return coinBalanceUpdated(_that.coinBalance);case _Cleared() when cleared != null:
|
||||
return cleared();case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() fetched,required TResult Function( int coinBalance) coinBalanceUpdated,required TResult Function() cleared,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Fetched():
|
||||
return fetched();case _CoinBalanceUpdated():
|
||||
return coinBalanceUpdated(_that.coinBalance);case _Cleared():
|
||||
return cleared();case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched,TResult? Function( int coinBalance)? coinBalanceUpdated,TResult? Function()? cleared,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Fetched() when fetched != null:
|
||||
return fetched();case _CoinBalanceUpdated() when coinBalanceUpdated != null:
|
||||
return coinBalanceUpdated(_that.coinBalance);case _Cleared() when cleared != null:
|
||||
return cleared();case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Fetched implements WalletLoaderEvent {
|
||||
const _Fetched();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Fetched);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _CoinBalanceUpdated implements WalletLoaderEvent {
|
||||
const _CoinBalanceUpdated(this.coinBalance);
|
||||
|
||||
|
||||
final int coinBalance;
|
||||
|
||||
/// Create a copy of WalletLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CoinBalanceUpdatedCopyWith<_CoinBalanceUpdated> get copyWith => __$CoinBalanceUpdatedCopyWithImpl<_CoinBalanceUpdated>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CoinBalanceUpdated&&(identical(other.coinBalance, coinBalance) || other.coinBalance == coinBalance));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return Object.hash(runtimeType,coinBalance);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletLoaderEvent.coinBalanceUpdated(coinBalance: $coinBalance)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CoinBalanceUpdatedCopyWith<$Res> implements $WalletLoaderEventCopyWith<$Res> {
|
||||
factory _$CoinBalanceUpdatedCopyWith(_CoinBalanceUpdated value, $Res Function(_CoinBalanceUpdated) _then) = __$CoinBalanceUpdatedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int coinBalance
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CoinBalanceUpdatedCopyWithImpl<$Res>
|
||||
implements _$CoinBalanceUpdatedCopyWith<$Res> {
|
||||
__$CoinBalanceUpdatedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CoinBalanceUpdated _self;
|
||||
final $Res Function(_CoinBalanceUpdated) _then;
|
||||
|
||||
/// Create a copy of WalletLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? coinBalance = null,}) {
|
||||
return _then(_CoinBalanceUpdated(
|
||||
null == coinBalance ? _self.coinBalance : coinBalance // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Cleared implements WalletLoaderEvent {
|
||||
const _Cleared();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Cleared);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletLoaderEvent.cleared()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$WalletLoaderState {
|
||||
|
||||
WalletSummary get summary; Option<WalletFailure> get failureOption; bool get isFetching; bool get hasLoaded;
|
||||
/// Create a copy of WalletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$WalletLoaderStateCopyWith<WalletLoaderState> get copyWith => _$WalletLoaderStateCopyWithImpl<WalletLoaderState>(this as WalletLoaderState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
final _this = this as WalletLoaderState;
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WalletLoaderState&&(identical(other.summary, _this.summary) || other.summary == _this.summary)&&(identical(other.failureOption, _this.failureOption) || other.failureOption == _this.failureOption)&&(identical(other.isFetching, _this.isFetching) || other.isFetching == _this.isFetching)&&(identical(other.hasLoaded, _this.hasLoaded) || other.hasLoaded == _this.hasLoaded));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
final _this = this as WalletLoaderState;
|
||||
return Object.hash(runtimeType,_this.summary,_this.failureOption,_this.isFetching,_this.hasLoaded);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
final _this = this as WalletLoaderState;
|
||||
return 'WalletLoaderState(summary: ${_this.summary}, failureOption: ${_this.failureOption}, isFetching: ${_this.isFetching}, hasLoaded: ${_this.hasLoaded})';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $WalletLoaderStateCopyWith<$Res> {
|
||||
factory $WalletLoaderStateCopyWith(WalletLoaderState value, $Res Function(WalletLoaderState) _then) = _$WalletLoaderStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
WalletSummary summary, Option<WalletFailure> failureOption, bool isFetching, bool hasLoaded
|
||||
});
|
||||
|
||||
|
||||
$WalletSummaryCopyWith<$Res> get summary;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$WalletLoaderStateCopyWithImpl<$Res>
|
||||
implements $WalletLoaderStateCopyWith<$Res> {
|
||||
_$WalletLoaderStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final WalletLoaderState _self;
|
||||
final $Res Function(WalletLoaderState) _then;
|
||||
|
||||
/// Create a copy of WalletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? summary = null,Object? failureOption = null,Object? isFetching = null,Object? hasLoaded = null,}) {
|
||||
return _then(WalletLoaderState(
|
||||
summary: null == summary ? _self.summary : summary // ignore: cast_nullable_to_non_nullable
|
||||
as WalletSummary,failureOption: null == failureOption ? _self.failureOption : failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<WalletFailure>,isFetching: null == isFetching ? _self.isFetching : isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,hasLoaded: null == hasLoaded ? _self.hasLoaded : hasLoaded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
/// Create a copy of WalletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$WalletSummaryCopyWith<$Res> get summary {
|
||||
|
||||
return $WalletSummaryCopyWith<$Res>(_self.summary, (value) {
|
||||
return _then(_self.copyWith(summary: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [WalletLoaderState].
|
||||
extension WalletLoaderStatePatterns on WalletLoaderState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _WalletLoaderState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletLoaderState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _WalletLoaderState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletLoaderState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _WalletLoaderState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletLoaderState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( WalletSummary summary, Option<WalletFailure> failureOption, bool isFetching, bool hasLoaded)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletLoaderState() when $default != null:
|
||||
return $default(_that.summary,_that.failureOption,_that.isFetching,_that.hasLoaded);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( WalletSummary summary, Option<WalletFailure> failureOption, bool isFetching, bool hasLoaded) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletLoaderState():
|
||||
return $default(_that.summary,_that.failureOption,_that.isFetching,_that.hasLoaded);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( WalletSummary summary, Option<WalletFailure> failureOption, bool isFetching, bool hasLoaded)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WalletLoaderState() when $default != null:
|
||||
return $default(_that.summary,_that.failureOption,_that.isFetching,_that.hasLoaded);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _WalletLoaderState implements WalletLoaderState {
|
||||
const _WalletLoaderState({required this.summary, required this.failureOption, this.isFetching = false, this.hasLoaded = false});
|
||||
|
||||
|
||||
@override final WalletSummary summary;
|
||||
@override final Option<WalletFailure> failureOption;
|
||||
@override@JsonKey() final bool isFetching;
|
||||
@override@JsonKey() final bool hasLoaded;
|
||||
|
||||
/// Create a copy of WalletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$WalletLoaderStateCopyWith<_WalletLoaderState> get copyWith => __$WalletLoaderStateCopyWithImpl<_WalletLoaderState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WalletLoaderState&&(identical(other.summary, summary) || other.summary == summary)&&(identical(other.failureOption, failureOption) || other.failureOption == failureOption)&&(identical(other.isFetching, isFetching) || other.isFetching == isFetching)&&(identical(other.hasLoaded, hasLoaded) || other.hasLoaded == hasLoaded));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return Object.hash(runtimeType,summary,failureOption,isFetching,hasLoaded);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WalletLoaderState(summary: $summary, failureOption: $failureOption, isFetching: $isFetching, hasLoaded: $hasLoaded)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$WalletLoaderStateCopyWith<$Res> implements $WalletLoaderStateCopyWith<$Res> {
|
||||
factory _$WalletLoaderStateCopyWith(_WalletLoaderState value, $Res Function(_WalletLoaderState) _then) = __$WalletLoaderStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
WalletSummary summary, Option<WalletFailure> failureOption, bool isFetching, bool hasLoaded
|
||||
});
|
||||
|
||||
|
||||
@override $WalletSummaryCopyWith<$Res> get summary;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$WalletLoaderStateCopyWithImpl<$Res>
|
||||
implements _$WalletLoaderStateCopyWith<$Res> {
|
||||
__$WalletLoaderStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _WalletLoaderState _self;
|
||||
final $Res Function(_WalletLoaderState) _then;
|
||||
|
||||
/// Create a copy of WalletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? summary = null,Object? failureOption = null,Object? isFetching = null,Object? hasLoaded = null,}) {
|
||||
return _then(_WalletLoaderState(
|
||||
summary: null == summary ? _self.summary : summary // ignore: cast_nullable_to_non_nullable
|
||||
as WalletSummary,failureOption: null == failureOption ? _self.failureOption : failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<WalletFailure>,isFetching: null == isFetching ? _self.isFetching : isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,hasLoaded: null == hasLoaded ? _self.hasLoaded : hasLoaded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of WalletLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$WalletSummaryCopyWith<$Res> get summary {
|
||||
|
||||
return $WalletSummaryCopyWith<$Res>(_self.summary, (value) {
|
||||
return _then(_self.copyWith(summary: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,13 @@
|
||||
part of 'wallet_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class WalletLoaderEvent with _$WalletLoaderEvent {
|
||||
const factory WalletLoaderEvent.fetched() = _Fetched;
|
||||
|
||||
/// Saldo EnakCoin terbaru dari hasil main game (`coins_remaining`).
|
||||
const factory WalletLoaderEvent.coinBalanceUpdated(int coinBalance) =
|
||||
_CoinBalanceUpdated;
|
||||
|
||||
/// Dipanggil saat logout supaya saldo akun sebelumnya tidak tertampil.
|
||||
const factory WalletLoaderEvent.cleared() = _Cleared;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
part of 'wallet_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class WalletLoaderState with _$WalletLoaderState {
|
||||
const factory WalletLoaderState({
|
||||
required WalletSummary summary,
|
||||
required Option<WalletFailure> failureOption,
|
||||
@Default(false) bool isFetching,
|
||||
@Default(false) bool hasLoaded,
|
||||
}) = _WalletLoaderState;
|
||||
|
||||
factory WalletLoaderState.initial() =>
|
||||
WalletLoaderState(summary: WalletSummary.empty(), failureOption: none());
|
||||
}
|
||||
Reference in New Issue
Block a user