forked from eatvio/eatvio_app
fix: remove ignored files
This commit is contained in:
@@ -1,197 +0,0 @@
|
||||
// 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 'diet_likes_model.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');
|
||||
|
||||
DietLikesModel _$DietLikesModelFromJson(Map<String, dynamic> json) {
|
||||
return _DietLikesModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DietLikesModel {
|
||||
@JsonKey(name: 'total_likers')
|
||||
int get totalLikes => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'is_liked')
|
||||
bool get isLiked => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this DietLikesModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of DietLikesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$DietLikesModelCopyWith<DietLikesModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DietLikesModelCopyWith<$Res> {
|
||||
factory $DietLikesModelCopyWith(
|
||||
DietLikesModel value, $Res Function(DietLikesModel) then) =
|
||||
_$DietLikesModelCopyWithImpl<$Res, DietLikesModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'total_likers') int totalLikes,
|
||||
@JsonKey(name: 'is_liked') bool isLiked});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DietLikesModelCopyWithImpl<$Res, $Val extends DietLikesModel>
|
||||
implements $DietLikesModelCopyWith<$Res> {
|
||||
_$DietLikesModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DietLikesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? totalLikes = null,
|
||||
Object? isLiked = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
totalLikes: null == totalLikes
|
||||
? _value.totalLikes
|
||||
: totalLikes // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
isLiked: null == isLiked
|
||||
? _value.isLiked
|
||||
: isLiked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DietLikesModelImplCopyWith<$Res>
|
||||
implements $DietLikesModelCopyWith<$Res> {
|
||||
factory _$$DietLikesModelImplCopyWith(_$DietLikesModelImpl value,
|
||||
$Res Function(_$DietLikesModelImpl) then) =
|
||||
__$$DietLikesModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'total_likers') int totalLikes,
|
||||
@JsonKey(name: 'is_liked') bool isLiked});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DietLikesModelImplCopyWithImpl<$Res>
|
||||
extends _$DietLikesModelCopyWithImpl<$Res, _$DietLikesModelImpl>
|
||||
implements _$$DietLikesModelImplCopyWith<$Res> {
|
||||
__$$DietLikesModelImplCopyWithImpl(
|
||||
_$DietLikesModelImpl _value, $Res Function(_$DietLikesModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DietLikesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? totalLikes = null,
|
||||
Object? isLiked = null,
|
||||
}) {
|
||||
return _then(_$DietLikesModelImpl(
|
||||
totalLikes: null == totalLikes
|
||||
? _value.totalLikes
|
||||
: totalLikes // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
isLiked: null == isLiked
|
||||
? _value.isLiked
|
||||
: isLiked // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$DietLikesModelImpl implements _DietLikesModel {
|
||||
const _$DietLikesModelImpl(
|
||||
{@JsonKey(name: 'total_likers') required this.totalLikes,
|
||||
@JsonKey(name: 'is_liked') required this.isLiked});
|
||||
|
||||
factory _$DietLikesModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$DietLikesModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'total_likers')
|
||||
final int totalLikes;
|
||||
@override
|
||||
@JsonKey(name: 'is_liked')
|
||||
final bool isLiked;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DietLikesModel(totalLikes: $totalLikes, isLiked: $isLiked)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DietLikesModelImpl &&
|
||||
(identical(other.totalLikes, totalLikes) ||
|
||||
other.totalLikes == totalLikes) &&
|
||||
(identical(other.isLiked, isLiked) || other.isLiked == isLiked));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, totalLikes, isLiked);
|
||||
|
||||
/// Create a copy of DietLikesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DietLikesModelImplCopyWith<_$DietLikesModelImpl> get copyWith =>
|
||||
__$$DietLikesModelImplCopyWithImpl<_$DietLikesModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$DietLikesModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _DietLikesModel implements DietLikesModel {
|
||||
const factory _DietLikesModel(
|
||||
{@JsonKey(name: 'total_likers') required final int totalLikes,
|
||||
@JsonKey(name: 'is_liked') required final bool isLiked}) =
|
||||
_$DietLikesModelImpl;
|
||||
|
||||
factory _DietLikesModel.fromJson(Map<String, dynamic> json) =
|
||||
_$DietLikesModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'total_likers')
|
||||
int get totalLikes;
|
||||
@override
|
||||
@JsonKey(name: 'is_liked')
|
||||
bool get isLiked;
|
||||
|
||||
/// Create a copy of DietLikesModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DietLikesModelImplCopyWith<_$DietLikesModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'diet_likes_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$DietLikesModelImpl _$$DietLikesModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$DietLikesModelImpl(
|
||||
totalLikes: (json['total_likers'] as num).toInt(),
|
||||
isLiked: json['is_liked'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$DietLikesModelImplToJson(
|
||||
_$DietLikesModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'total_likers': instance.totalLikes,
|
||||
'is_liked': instance.isLiked,
|
||||
};
|
||||
@@ -1,830 +0,0 @@
|
||||
// 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 'about_diet_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 _$AboutDietState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value) $default, {
|
||||
required TResult Function(DietStateInitial value) initial,
|
||||
required TResult Function(DietStateLoading value) loading,
|
||||
required TResult Function(DietStateLoaded value) loaded,
|
||||
required TResult Function(DietStateError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_AboutDietState value)? $default, {
|
||||
TResult? Function(DietStateInitial value)? initial,
|
||||
TResult? Function(DietStateLoading value)? loading,
|
||||
TResult? Function(DietStateLoaded value)? loaded,
|
||||
TResult? Function(DietStateError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value)? $default, {
|
||||
TResult Function(DietStateInitial value)? initial,
|
||||
TResult Function(DietStateLoading value)? loading,
|
||||
TResult Function(DietStateLoaded value)? loaded,
|
||||
TResult Function(DietStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AboutDietStateCopyWith<$Res> {
|
||||
factory $AboutDietStateCopyWith(
|
||||
AboutDietState value, $Res Function(AboutDietState) then) =
|
||||
_$AboutDietStateCopyWithImpl<$Res, AboutDietState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AboutDietStateCopyWithImpl<$Res, $Val extends AboutDietState>
|
||||
implements $AboutDietStateCopyWith<$Res> {
|
||||
_$AboutDietStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AboutDietStateImplCopyWith<$Res> {
|
||||
factory _$$AboutDietStateImplCopyWith(_$AboutDietStateImpl value,
|
||||
$Res Function(_$AboutDietStateImpl) then) =
|
||||
__$$AboutDietStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AboutDietStateImplCopyWithImpl<$Res>
|
||||
extends _$AboutDietStateCopyWithImpl<$Res, _$AboutDietStateImpl>
|
||||
implements _$$AboutDietStateImplCopyWith<$Res> {
|
||||
__$$AboutDietStateImplCopyWithImpl(
|
||||
_$AboutDietStateImpl _value, $Res Function(_$AboutDietStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AboutDietStateImpl implements _AboutDietState {
|
||||
const _$AboutDietStateImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AboutDietState()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$AboutDietStateImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return $default();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return $default?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value) $default, {
|
||||
required TResult Function(DietStateInitial value) initial,
|
||||
required TResult Function(DietStateLoading value) loading,
|
||||
required TResult Function(DietStateLoaded value) loaded,
|
||||
required TResult Function(DietStateError value) error,
|
||||
}) {
|
||||
return $default(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_AboutDietState value)? $default, {
|
||||
TResult? Function(DietStateInitial value)? initial,
|
||||
TResult? Function(DietStateLoading value)? loading,
|
||||
TResult? Function(DietStateLoaded value)? loaded,
|
||||
TResult? Function(DietStateError value)? error,
|
||||
}) {
|
||||
return $default?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value)? $default, {
|
||||
TResult Function(DietStateInitial value)? initial,
|
||||
TResult Function(DietStateLoading value)? loading,
|
||||
TResult Function(DietStateLoaded value)? loaded,
|
||||
TResult Function(DietStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AboutDietState implements AboutDietState {
|
||||
const factory _AboutDietState() = _$AboutDietStateImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DietStateInitialImplCopyWith<$Res> {
|
||||
factory _$$DietStateInitialImplCopyWith(_$DietStateInitialImpl value,
|
||||
$Res Function(_$DietStateInitialImpl) then) =
|
||||
__$$DietStateInitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DietStateInitialImplCopyWithImpl<$Res>
|
||||
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateInitialImpl>
|
||||
implements _$$DietStateInitialImplCopyWith<$Res> {
|
||||
__$$DietStateInitialImplCopyWithImpl(_$DietStateInitialImpl _value,
|
||||
$Res Function(_$DietStateInitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DietStateInitialImpl implements DietStateInitial {
|
||||
const _$DietStateInitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AboutDietState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$DietStateInitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value) $default, {
|
||||
required TResult Function(DietStateInitial value) initial,
|
||||
required TResult Function(DietStateLoading value) loading,
|
||||
required TResult Function(DietStateLoaded value) loaded,
|
||||
required TResult Function(DietStateError value) error,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_AboutDietState value)? $default, {
|
||||
TResult? Function(DietStateInitial value)? initial,
|
||||
TResult? Function(DietStateLoading value)? loading,
|
||||
TResult? Function(DietStateLoaded value)? loaded,
|
||||
TResult? Function(DietStateError value)? error,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value)? $default, {
|
||||
TResult Function(DietStateInitial value)? initial,
|
||||
TResult Function(DietStateLoading value)? loading,
|
||||
TResult Function(DietStateLoaded value)? loaded,
|
||||
TResult Function(DietStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DietStateInitial implements AboutDietState {
|
||||
const factory DietStateInitial() = _$DietStateInitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DietStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$DietStateLoadingImplCopyWith(_$DietStateLoadingImpl value,
|
||||
$Res Function(_$DietStateLoadingImpl) then) =
|
||||
__$$DietStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DietStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateLoadingImpl>
|
||||
implements _$$DietStateLoadingImplCopyWith<$Res> {
|
||||
__$$DietStateLoadingImplCopyWithImpl(_$DietStateLoadingImpl _value,
|
||||
$Res Function(_$DietStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DietStateLoadingImpl implements DietStateLoading {
|
||||
const _$DietStateLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AboutDietState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$DietStateLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value) $default, {
|
||||
required TResult Function(DietStateInitial value) initial,
|
||||
required TResult Function(DietStateLoading value) loading,
|
||||
required TResult Function(DietStateLoaded value) loaded,
|
||||
required TResult Function(DietStateError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_AboutDietState value)? $default, {
|
||||
TResult? Function(DietStateInitial value)? initial,
|
||||
TResult? Function(DietStateLoading value)? loading,
|
||||
TResult? Function(DietStateLoaded value)? loaded,
|
||||
TResult? Function(DietStateError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value)? $default, {
|
||||
TResult Function(DietStateInitial value)? initial,
|
||||
TResult Function(DietStateLoading value)? loading,
|
||||
TResult Function(DietStateLoaded value)? loaded,
|
||||
TResult Function(DietStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DietStateLoading implements AboutDietState {
|
||||
const factory DietStateLoading() = _$DietStateLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DietStateLoadedImplCopyWith<$Res> {
|
||||
factory _$$DietStateLoadedImplCopyWith(_$DietStateLoadedImpl value,
|
||||
$Res Function(_$DietStateLoadedImpl) then) =
|
||||
__$$DietStateLoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({Diet diet, bool isStarted, bool hasStartedDiet});
|
||||
|
||||
$DietCopyWith<$Res> get diet;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DietStateLoadedImplCopyWithImpl<$Res>
|
||||
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateLoadedImpl>
|
||||
implements _$$DietStateLoadedImplCopyWith<$Res> {
|
||||
__$$DietStateLoadedImplCopyWithImpl(
|
||||
_$DietStateLoadedImpl _value, $Res Function(_$DietStateLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? diet = null,
|
||||
Object? isStarted = null,
|
||||
Object? hasStartedDiet = null,
|
||||
}) {
|
||||
return _then(_$DietStateLoadedImpl(
|
||||
diet: null == diet
|
||||
? _value.diet
|
||||
: diet // ignore: cast_nullable_to_non_nullable
|
||||
as Diet,
|
||||
isStarted: null == isStarted
|
||||
? _value.isStarted
|
||||
: isStarted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
hasStartedDiet: null == hasStartedDiet
|
||||
? _value.hasStartedDiet
|
||||
: hasStartedDiet // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$DietCopyWith<$Res> get diet {
|
||||
return $DietCopyWith<$Res>(_value.diet, (value) {
|
||||
return _then(_value.copyWith(diet: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DietStateLoadedImpl implements DietStateLoaded {
|
||||
const _$DietStateLoadedImpl(
|
||||
{required this.diet,
|
||||
this.isStarted = false,
|
||||
this.hasStartedDiet = false});
|
||||
|
||||
@override
|
||||
final Diet diet;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isStarted;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool hasStartedDiet;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AboutDietState.loaded(diet: $diet, isStarted: $isStarted, hasStartedDiet: $hasStartedDiet)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DietStateLoadedImpl &&
|
||||
(identical(other.diet, diet) || other.diet == diet) &&
|
||||
(identical(other.isStarted, isStarted) ||
|
||||
other.isStarted == isStarted) &&
|
||||
(identical(other.hasStartedDiet, hasStartedDiet) ||
|
||||
other.hasStartedDiet == hasStartedDiet));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, diet, isStarted, hasStartedDiet);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DietStateLoadedImplCopyWith<_$DietStateLoadedImpl> get copyWith =>
|
||||
__$$DietStateLoadedImplCopyWithImpl<_$DietStateLoadedImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loaded(diet, isStarted, hasStartedDiet);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loaded?.call(diet, isStarted, hasStartedDiet);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(diet, isStarted, hasStartedDiet);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value) $default, {
|
||||
required TResult Function(DietStateInitial value) initial,
|
||||
required TResult Function(DietStateLoading value) loading,
|
||||
required TResult Function(DietStateLoaded value) loaded,
|
||||
required TResult Function(DietStateError value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_AboutDietState value)? $default, {
|
||||
TResult? Function(DietStateInitial value)? initial,
|
||||
TResult? Function(DietStateLoading value)? loading,
|
||||
TResult? Function(DietStateLoaded value)? loaded,
|
||||
TResult? Function(DietStateError value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value)? $default, {
|
||||
TResult Function(DietStateInitial value)? initial,
|
||||
TResult Function(DietStateLoading value)? loading,
|
||||
TResult Function(DietStateLoaded value)? loaded,
|
||||
TResult Function(DietStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DietStateLoaded implements AboutDietState {
|
||||
const factory DietStateLoaded(
|
||||
{required final Diet diet,
|
||||
final bool isStarted,
|
||||
final bool hasStartedDiet}) = _$DietStateLoadedImpl;
|
||||
|
||||
Diet get diet;
|
||||
bool get isStarted;
|
||||
bool get hasStartedDiet;
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DietStateLoadedImplCopyWith<_$DietStateLoadedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DietStateErrorImplCopyWith<$Res> {
|
||||
factory _$$DietStateErrorImplCopyWith(_$DietStateErrorImpl value,
|
||||
$Res Function(_$DietStateErrorImpl) then) =
|
||||
__$$DietStateErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String message});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DietStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$AboutDietStateCopyWithImpl<$Res, _$DietStateErrorImpl>
|
||||
implements _$$DietStateErrorImplCopyWith<$Res> {
|
||||
__$$DietStateErrorImplCopyWithImpl(
|
||||
_$DietStateErrorImpl _value, $Res Function(_$DietStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? message = null,
|
||||
}) {
|
||||
return _then(_$DietStateErrorImpl(
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DietStateErrorImpl implements DietStateError {
|
||||
const _$DietStateErrorImpl({required this.message});
|
||||
|
||||
@override
|
||||
final String message;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AboutDietState.error(message: $message)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DietStateErrorImpl &&
|
||||
(identical(other.message, message) || other.message == message));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, message);
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DietStateErrorImplCopyWith<_$DietStateErrorImpl> get copyWith =>
|
||||
__$$DietStateErrorImplCopyWithImpl<_$DietStateErrorImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)
|
||||
loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return error(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return error?.call(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(Diet diet, bool isStarted, bool hasStartedDiet)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(message);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value) $default, {
|
||||
required TResult Function(DietStateInitial value) initial,
|
||||
required TResult Function(DietStateLoading value) loading,
|
||||
required TResult Function(DietStateLoaded value) loaded,
|
||||
required TResult Function(DietStateError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_AboutDietState value)? $default, {
|
||||
TResult? Function(DietStateInitial value)? initial,
|
||||
TResult? Function(DietStateLoading value)? loading,
|
||||
TResult? Function(DietStateLoaded value)? loaded,
|
||||
TResult? Function(DietStateError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_AboutDietState value)? $default, {
|
||||
TResult Function(DietStateInitial value)? initial,
|
||||
TResult Function(DietStateLoading value)? loading,
|
||||
TResult Function(DietStateLoaded value)? loaded,
|
||||
TResult Function(DietStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DietStateError implements AboutDietState {
|
||||
const factory DietStateError({required final String message}) =
|
||||
_$DietStateErrorImpl;
|
||||
|
||||
String get message;
|
||||
|
||||
/// Create a copy of AboutDietState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DietStateErrorImplCopyWith<_$DietStateErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'diet_service.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RetrofitGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers,unused_element,unnecessary_string_interpolations
|
||||
|
||||
class _DietService implements DietService {
|
||||
_DietService(this._dio, {this.baseUrl, this.errorLogger});
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
String? baseUrl;
|
||||
|
||||
final ParseErrorLogger? errorLogger;
|
||||
|
||||
@override
|
||||
Future<DietLikesModel> likeDiet({required int id}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<DietLikesModel>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/like',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late DietLikesModel _value;
|
||||
try {
|
||||
_value = DietLikesModel.fromJson(_result.data!);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Diet> addToFavorite({required int id}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Diet>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/add_to_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Diet _value;
|
||||
try {
|
||||
_value = Diet.fromJson(_result.data!);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Diet> removeFromFavorite({required int id}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Diet>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/remove_from_favorite',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Diet _value;
|
||||
try {
|
||||
_value = Diet.fromJson(_result.data!);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Diet> getDiet({required int id}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<Diet>(
|
||||
Options(method: 'GET', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/show/${id}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Diet _value;
|
||||
try {
|
||||
_value = Diet.fromJson(_result.data!);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> startDiet({
|
||||
required int id,
|
||||
required Map<String, dynamic> body,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = <String, dynamic>{};
|
||||
_data.addAll(body);
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/start',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> cancelDiet({required int id}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<void>(
|
||||
Options(method: 'POST', headers: _headers, extra: _extra)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/diets/${id}/cancel',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
|
||||
);
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||
if (T != dynamic &&
|
||||
!(requestOptions.responseType == ResponseType.bytes ||
|
||||
requestOptions.responseType == ResponseType.stream)) {
|
||||
if (T == String) {
|
||||
requestOptions.responseType = ResponseType.plain;
|
||||
} else {
|
||||
requestOptions.responseType = ResponseType.json;
|
||||
}
|
||||
}
|
||||
return requestOptions;
|
||||
}
|
||||
|
||||
String _combineBaseUrls(String dioBaseUrl, String? baseUrl) {
|
||||
if (baseUrl == null || baseUrl.trim().isEmpty) {
|
||||
return dioBaseUrl;
|
||||
}
|
||||
|
||||
final url = Uri.parse(baseUrl);
|
||||
|
||||
if (url.isAbsolute) {
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
return Uri.parse(dioBaseUrl).resolveUri(url).toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user