loadable error screen, reload actions, autoreload
This commit is contained in:
@ -18,6 +18,7 @@ final _privateConstructorUsedError = UnsupportedError(
|
||||
mixin _$LoadableState<TState> {
|
||||
bool get isLoading => throw _privateConstructorUsedError;
|
||||
TState? get data => throw _privateConstructorUsedError;
|
||||
LoadingError? get error => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$LoadableStateCopyWith<TState, LoadableState<TState>> get copyWith =>
|
||||
@ -30,7 +31,9 @@ abstract class $LoadableStateCopyWith<TState, $Res> {
|
||||
$Res Function(LoadableState<TState>) then) =
|
||||
_$LoadableStateCopyWithImpl<TState, $Res, LoadableState<TState>>;
|
||||
@useResult
|
||||
$Res call({bool isLoading, TState? data});
|
||||
$Res call({bool isLoading, TState? data, LoadingError? error});
|
||||
|
||||
$LoadingErrorCopyWith<$Res>? get error;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -49,6 +52,7 @@ class _$LoadableStateCopyWithImpl<TState, $Res,
|
||||
$Res call({
|
||||
Object? isLoading = null,
|
||||
Object? data = freezed,
|
||||
Object? error = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
isLoading: null == isLoading
|
||||
@ -59,8 +63,24 @@ class _$LoadableStateCopyWithImpl<TState, $Res,
|
||||
? _value.data
|
||||
: data // ignore: cast_nullable_to_non_nullable
|
||||
as TState?,
|
||||
error: freezed == error
|
||||
? _value.error
|
||||
: error // ignore: cast_nullable_to_non_nullable
|
||||
as LoadingError?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LoadingErrorCopyWith<$Res>? get error {
|
||||
if (_value.error == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $LoadingErrorCopyWith<$Res>(_value.error!, (value) {
|
||||
return _then(_value.copyWith(error: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -71,7 +91,10 @@ abstract class _$$LoadableStateImplCopyWith<TState, $Res>
|
||||
__$$LoadableStateImplCopyWithImpl<TState, $Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({bool isLoading, TState? data});
|
||||
$Res call({bool isLoading, TState? data, LoadingError? error});
|
||||
|
||||
@override
|
||||
$LoadingErrorCopyWith<$Res>? get error;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -88,6 +111,7 @@ class __$$LoadableStateImplCopyWithImpl<TState, $Res>
|
||||
$Res call({
|
||||
Object? isLoading = null,
|
||||
Object? data = freezed,
|
||||
Object? error = freezed,
|
||||
}) {
|
||||
return _then(_$LoadableStateImpl<TState>(
|
||||
isLoading: null == isLoading
|
||||
@ -98,6 +122,10 @@ class __$$LoadableStateImplCopyWithImpl<TState, $Res>
|
||||
? _value.data
|
||||
: data // ignore: cast_nullable_to_non_nullable
|
||||
as TState?,
|
||||
error: freezed == error
|
||||
? _value.error
|
||||
: error // ignore: cast_nullable_to_non_nullable
|
||||
as LoadingError?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -105,7 +133,8 @@ class __$$LoadableStateImplCopyWithImpl<TState, $Res>
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadableStateImpl<TState> extends _LoadableState<TState> {
|
||||
const _$LoadableStateImpl({this.isLoading = true, this.data = null})
|
||||
const _$LoadableStateImpl(
|
||||
{this.isLoading = true, this.data = null, this.error = null})
|
||||
: super._();
|
||||
|
||||
@override
|
||||
@ -114,10 +143,13 @@ class _$LoadableStateImpl<TState> extends _LoadableState<TState> {
|
||||
@override
|
||||
@JsonKey()
|
||||
final TState? data;
|
||||
@override
|
||||
@JsonKey()
|
||||
final LoadingError? error;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoadableState<$TState>(isLoading: $isLoading, data: $data)';
|
||||
return 'LoadableState<$TState>(isLoading: $isLoading, data: $data, error: $error)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -127,12 +159,13 @@ class _$LoadableStateImpl<TState> extends _LoadableState<TState> {
|
||||
other is _$LoadableStateImpl<TState> &&
|
||||
(identical(other.isLoading, isLoading) ||
|
||||
other.isLoading == isLoading) &&
|
||||
const DeepCollectionEquality().equals(other.data, data));
|
||||
const DeepCollectionEquality().equals(other.data, data) &&
|
||||
(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, isLoading, const DeepCollectionEquality().hash(data));
|
||||
runtimeType, isLoading, const DeepCollectionEquality().hash(data), error);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@ -143,8 +176,10 @@ class _$LoadableStateImpl<TState> extends _LoadableState<TState> {
|
||||
}
|
||||
|
||||
abstract class _LoadableState<TState> extends LoadableState<TState> {
|
||||
const factory _LoadableState({final bool isLoading, final TState? data}) =
|
||||
_$LoadableStateImpl<TState>;
|
||||
const factory _LoadableState(
|
||||
{final bool isLoading,
|
||||
final TState? data,
|
||||
final LoadingError? error}) = _$LoadableStateImpl<TState>;
|
||||
const _LoadableState._() : super._();
|
||||
|
||||
@override
|
||||
@ -152,6 +187,8 @@ abstract class _LoadableState<TState> extends LoadableState<TState> {
|
||||
@override
|
||||
TState? get data;
|
||||
@override
|
||||
LoadingError? get error;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$LoadableStateImplCopyWith<TState, _$LoadableStateImpl<TState>>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
|
Reference in New Issue
Block a user