forked from eatvio/eatvio_app
feat(diary): New models for calendar and autocomplete fix
This commit is contained in:
20
lib/features/calendar/presentation/bloc/calendar_cubit.dart
Normal file
20
lib/features/calendar/presentation/bloc/calendar_cubit.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_state.dart';
|
||||
import 'package:eatvio_app/features/calendar/repositories/calendar_repository.dart';
|
||||
|
||||
class CalendarCubit extends Cubit<CalendarState> {
|
||||
final CalendarRepository calendarRepository;
|
||||
|
||||
CalendarCubit({required this.calendarRepository})
|
||||
: super(const CalendarState.loading());
|
||||
|
||||
loadCalendarList() async {
|
||||
emit(const CalendarState.loading());
|
||||
try {
|
||||
final calendarList = await calendarRepository.getCalendar();
|
||||
emit(CalendarState.loaded(calendarList: calendarList));
|
||||
} catch (e) {
|
||||
emit(CalendarState.error(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
19
lib/features/calendar/presentation/bloc/calendar_state.dart
Normal file
19
lib/features/calendar/presentation/bloc/calendar_state.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:eatvio_app/features/calendar/models/calendar_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'calendar_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CalendarState with _$CalendarState {
|
||||
const factory CalendarState() = _CalendarState;
|
||||
|
||||
const factory CalendarState.loading() = CalendarStateLoading;
|
||||
|
||||
const factory CalendarState.loaded({
|
||||
required List<CalendarModel> calendarList,
|
||||
}) = CalendarStateLoaded;
|
||||
|
||||
const factory CalendarState.error({
|
||||
required String errorMessage,
|
||||
}) = CalendarStateError;
|
||||
}
|
||||
@@ -0,0 +1,621 @@
|
||||
// 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 'calendar_state.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 _$CalendarState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<CalendarModel> calendarList) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value) $default, {
|
||||
required TResult Function(CalendarStateLoading value) loading,
|
||||
required TResult Function(CalendarStateLoaded value) loaded,
|
||||
required TResult Function(CalendarStateError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_CalendarState value)? $default, {
|
||||
TResult? Function(CalendarStateLoading value)? loading,
|
||||
TResult? Function(CalendarStateLoaded value)? loaded,
|
||||
TResult? Function(CalendarStateError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value)? $default, {
|
||||
TResult Function(CalendarStateLoading value)? loading,
|
||||
TResult Function(CalendarStateLoaded value)? loaded,
|
||||
TResult Function(CalendarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CalendarStateCopyWith<$Res> {
|
||||
factory $CalendarStateCopyWith(
|
||||
CalendarState value, $Res Function(CalendarState) then) =
|
||||
_$CalendarStateCopyWithImpl<$Res, CalendarState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CalendarStateCopyWithImpl<$Res, $Val extends CalendarState>
|
||||
implements $CalendarStateCopyWith<$Res> {
|
||||
_$CalendarStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CalendarStateImplCopyWith<$Res> {
|
||||
factory _$$CalendarStateImplCopyWith(
|
||||
_$CalendarStateImpl value, $Res Function(_$CalendarStateImpl) then) =
|
||||
__$$CalendarStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CalendarStateImplCopyWithImpl<$Res>
|
||||
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateImpl>
|
||||
implements _$$CalendarStateImplCopyWith<$Res> {
|
||||
__$$CalendarStateImplCopyWithImpl(
|
||||
_$CalendarStateImpl _value, $Res Function(_$CalendarStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CalendarStateImpl implements _CalendarState {
|
||||
const _$CalendarStateImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CalendarState()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$CalendarStateImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<CalendarModel> calendarList) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return $default();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return $default?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value) $default, {
|
||||
required TResult Function(CalendarStateLoading value) loading,
|
||||
required TResult Function(CalendarStateLoaded value) loaded,
|
||||
required TResult Function(CalendarStateError value) error,
|
||||
}) {
|
||||
return $default(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_CalendarState value)? $default, {
|
||||
TResult? Function(CalendarStateLoading value)? loading,
|
||||
TResult? Function(CalendarStateLoaded value)? loaded,
|
||||
TResult? Function(CalendarStateError value)? error,
|
||||
}) {
|
||||
return $default?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value)? $default, {
|
||||
TResult Function(CalendarStateLoading value)? loading,
|
||||
TResult Function(CalendarStateLoaded value)? loaded,
|
||||
TResult Function(CalendarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CalendarState implements CalendarState {
|
||||
const factory _CalendarState() = _$CalendarStateImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CalendarStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$CalendarStateLoadingImplCopyWith(_$CalendarStateLoadingImpl value,
|
||||
$Res Function(_$CalendarStateLoadingImpl) then) =
|
||||
__$$CalendarStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CalendarStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadingImpl>
|
||||
implements _$$CalendarStateLoadingImplCopyWith<$Res> {
|
||||
__$$CalendarStateLoadingImplCopyWithImpl(_$CalendarStateLoadingImpl _value,
|
||||
$Res Function(_$CalendarStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CalendarStateLoadingImpl implements CalendarStateLoading {
|
||||
const _$CalendarStateLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CalendarState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CalendarStateLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<CalendarModel> calendarList) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value) $default, {
|
||||
required TResult Function(CalendarStateLoading value) loading,
|
||||
required TResult Function(CalendarStateLoaded value) loaded,
|
||||
required TResult Function(CalendarStateError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_CalendarState value)? $default, {
|
||||
TResult? Function(CalendarStateLoading value)? loading,
|
||||
TResult? Function(CalendarStateLoaded value)? loaded,
|
||||
TResult? Function(CalendarStateError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value)? $default, {
|
||||
TResult Function(CalendarStateLoading value)? loading,
|
||||
TResult Function(CalendarStateLoaded value)? loaded,
|
||||
TResult Function(CalendarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class CalendarStateLoading implements CalendarState {
|
||||
const factory CalendarStateLoading() = _$CalendarStateLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CalendarStateLoadedImplCopyWith<$Res> {
|
||||
factory _$$CalendarStateLoadedImplCopyWith(_$CalendarStateLoadedImpl value,
|
||||
$Res Function(_$CalendarStateLoadedImpl) then) =
|
||||
__$$CalendarStateLoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({List<CalendarModel> calendarList});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CalendarStateLoadedImplCopyWithImpl<$Res>
|
||||
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadedImpl>
|
||||
implements _$$CalendarStateLoadedImplCopyWith<$Res> {
|
||||
__$$CalendarStateLoadedImplCopyWithImpl(_$CalendarStateLoadedImpl _value,
|
||||
$Res Function(_$CalendarStateLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? calendarList = null,
|
||||
}) {
|
||||
return _then(_$CalendarStateLoadedImpl(
|
||||
calendarList: null == calendarList
|
||||
? _value._calendarList
|
||||
: calendarList // ignore: cast_nullable_to_non_nullable
|
||||
as List<CalendarModel>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
|
||||
const _$CalendarStateLoadedImpl(
|
||||
{required final List<CalendarModel> calendarList})
|
||||
: _calendarList = calendarList;
|
||||
|
||||
final List<CalendarModel> _calendarList;
|
||||
@override
|
||||
List<CalendarModel> get calendarList {
|
||||
if (_calendarList is EqualUnmodifiableListView) return _calendarList;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_calendarList);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CalendarState.loaded(calendarList: $calendarList)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CalendarStateLoadedImpl &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._calendarList, _calendarList));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, const DeepCollectionEquality().hash(_calendarList));
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith =>
|
||||
__$$CalendarStateLoadedImplCopyWithImpl<_$CalendarStateLoadedImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<CalendarModel> calendarList) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loaded(calendarList);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loaded?.call(calendarList);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(calendarList);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value) $default, {
|
||||
required TResult Function(CalendarStateLoading value) loading,
|
||||
required TResult Function(CalendarStateLoaded value) loaded,
|
||||
required TResult Function(CalendarStateError value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_CalendarState value)? $default, {
|
||||
TResult? Function(CalendarStateLoading value)? loading,
|
||||
TResult? Function(CalendarStateLoaded value)? loaded,
|
||||
TResult? Function(CalendarStateError value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value)? $default, {
|
||||
TResult Function(CalendarStateLoading value)? loading,
|
||||
TResult Function(CalendarStateLoaded value)? loaded,
|
||||
TResult Function(CalendarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class CalendarStateLoaded implements CalendarState {
|
||||
const factory CalendarStateLoaded(
|
||||
{required final List<CalendarModel> calendarList}) =
|
||||
_$CalendarStateLoadedImpl;
|
||||
|
||||
List<CalendarModel> get calendarList;
|
||||
@JsonKey(ignore: true)
|
||||
_$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CalendarStateErrorImplCopyWith<$Res> {
|
||||
factory _$$CalendarStateErrorImplCopyWith(_$CalendarStateErrorImpl value,
|
||||
$Res Function(_$CalendarStateErrorImpl) then) =
|
||||
__$$CalendarStateErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String errorMessage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CalendarStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateErrorImpl>
|
||||
implements _$$CalendarStateErrorImplCopyWith<$Res> {
|
||||
__$$CalendarStateErrorImplCopyWithImpl(_$CalendarStateErrorImpl _value,
|
||||
$Res Function(_$CalendarStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? errorMessage = null,
|
||||
}) {
|
||||
return _then(_$CalendarStateErrorImpl(
|
||||
errorMessage: null == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CalendarStateErrorImpl implements CalendarStateError {
|
||||
const _$CalendarStateErrorImpl({required this.errorMessage});
|
||||
|
||||
@override
|
||||
final String errorMessage;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CalendarState.error(errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CalendarStateErrorImpl &&
|
||||
(identical(other.errorMessage, errorMessage) ||
|
||||
other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, errorMessage);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith =>
|
||||
__$$CalendarStateErrorImplCopyWithImpl<_$CalendarStateErrorImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<CalendarModel> calendarList) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return error?.call(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<CalendarModel> calendarList)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value) $default, {
|
||||
required TResult Function(CalendarStateLoading value) loading,
|
||||
required TResult Function(CalendarStateLoaded value) loaded,
|
||||
required TResult Function(CalendarStateError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_CalendarState value)? $default, {
|
||||
TResult? Function(CalendarStateLoading value)? loading,
|
||||
TResult? Function(CalendarStateLoaded value)? loaded,
|
||||
TResult? Function(CalendarStateError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_CalendarState value)? $default, {
|
||||
TResult Function(CalendarStateLoading value)? loading,
|
||||
TResult Function(CalendarStateLoaded value)? loaded,
|
||||
TResult Function(CalendarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class CalendarStateError implements CalendarState {
|
||||
const factory CalendarStateError({required final String errorMessage}) =
|
||||
_$CalendarStateErrorImpl;
|
||||
|
||||
String get errorMessage;
|
||||
@JsonKey(ignore: true)
|
||||
_$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user