forked from eatvio/eatvio_app
fixed likes and favourite sync and adeded filter leayoutfor diets
This commit is contained in:
14
lib/core/data/diet/models/diet_likes_model.dart
Normal file
14
lib/core/data/diet/models/diet_likes_model.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'diet_likes_model.freezed.dart';
|
||||
part 'diet_likes_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class DietLikesModel with _$DietLikesModel {
|
||||
const factory DietLikesModel({
|
||||
@JsonKey(name: 'total_likers') required int totalLikes,
|
||||
@JsonKey(name: 'is_liked') required bool isLiked,
|
||||
}) = _DietLikesModel;
|
||||
|
||||
factory DietLikesModel.fromJson(Map<String, Object?> json) => _$DietLikesModelFromJson(json);
|
||||
}
|
||||
197
lib/core/data/diet/models/diet_likes_model.freezed.dart
Normal file
197
lib/core/data/diet/models/diet_likes_model.freezed.dart
Normal file
@@ -0,0 +1,197 @@
|
||||
// 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;
|
||||
}
|
||||
20
lib/core/data/diet/models/diet_likes_model.g.dart
Normal file
20
lib/core/data/diet/models/diet_likes_model.g.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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,
|
||||
};
|
||||
Reference in New Issue
Block a user