Add a third option to the theme mode

This allows the user to use the system settings as well, and not always force
light or dark mode in the app. Also move the logic to the UserProvider and
do some light refactoring.
This commit is contained in:
Roland Geider
2025-01-23 23:22:50 +01:00
parent 8dc72b9fc4
commit 86f8b7ae35
61 changed files with 952 additions and 1237 deletions

View File

@@ -18,8 +18,7 @@ WeightEntry _$WeightEntryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WeightEntryToJson(WeightEntry instance) =>
<String, dynamic>{
Map<String, dynamic> _$WeightEntryToJson(WeightEntry instance) => <String, dynamic>{
'id': instance.id,
'weight': numToString(instance.weight),
'date': toDate(instance.date),

View File

@@ -17,8 +17,7 @@ ExerciseCategory _$ExerciseCategoryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$ExerciseCategoryToJson(ExerciseCategory instance) =>
<String, dynamic>{
Map<String, dynamic> _$ExerciseCategoryToJson(ExerciseCategory instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -25,12 +25,8 @@ Exercise _$ExerciseFromJson(Map<String, dynamic> json) {
return Exercise(
id: (json['id'] as num?)?.toInt(),
uuid: json['uuid'] as String?,
created: json['created'] == null
? null
: DateTime.parse(json['created'] as String),
lastUpdate: json['last_update'] == null
? null
: DateTime.parse(json['last_update'] as String),
created: json['created'] == null ? null : DateTime.parse(json['created'] as String),
lastUpdate: json['last_update'] == null ? null : DateTime.parse(json['last_update'] as String),
lastUpdateGlobal: json['last_update_global'] == null
? null
: DateTime.parse(json['last_update_global'] as String),
@@ -43,15 +39,10 @@ Exercise _$ExerciseFromJson(Map<String, dynamic> json) {
: ExerciseCategory.fromJson(json['categories'] as Map<String, dynamic>),
)
..categoryId = (json['category'] as num).toInt()
..musclesIds = (json['muscles'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList()
..musclesSecondaryIds = (json['muscles_secondary'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList()
..equipmentIds = (json['equipment'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList();
..musclesIds = (json['muscles'] as List<dynamic>).map((e) => (e as num).toInt()).toList()
..musclesSecondaryIds =
(json['muscles_secondary'] as List<dynamic>).map((e) => (e as num).toInt()).toList()
..equipmentIds = (json['equipment'] as List<dynamic>).map((e) => (e as num).toInt()).toList();
}
Map<String, dynamic> _$ExerciseToJson(Exercise instance) => <String, dynamic>{
@@ -65,7 +56,6 @@ Map<String, dynamic> _$ExerciseToJson(Exercise instance) => <String, dynamic>{
'categories': instance.category?.toJson(),
'muscles': instance.musclesIds,
'muscles_secondary': instance.musclesSecondaryIds,
'musclesSecondary':
instance.musclesSecondary.map((e) => e.toJson()).toList(),
'musclesSecondary': instance.musclesSecondary.map((e) => e.toJson()).toList(),
'equipment': instance.equipmentIds,
};

View File

@@ -21,14 +21,11 @@ ExerciseApiData _$ExerciseApiDataFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ExerciseApiData {
int get id => throw _privateConstructorUsedError;
String get uuid =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
String get uuid => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'variations')
int? get variationId =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
int? get variationId => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'created')
DateTime get created =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
DateTime get created => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'last_update')
DateTime get lastUpdate =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@@ -45,8 +42,7 @@ mixin _$ExerciseApiData {
@JsonKey(name: 'exercises')
List<Translation> get translations => throw _privateConstructorUsedError;
List<ExerciseImage> get images => throw _privateConstructorUsedError;
List<Video> get videos =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
List<Video> get videos => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'author_history')
List<String> get authors =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@@ -59,14 +55,12 @@ mixin _$ExerciseApiData {
/// Create a copy of ExerciseApiData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ExerciseApiDataCopyWith<ExerciseApiData> get copyWith =>
throw _privateConstructorUsedError;
$ExerciseApiDataCopyWith<ExerciseApiData> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ExerciseApiDataCopyWith<$Res> {
factory $ExerciseApiDataCopyWith(
ExerciseApiData value, $Res Function(ExerciseApiData) then) =
factory $ExerciseApiDataCopyWith(ExerciseApiData value, $Res Function(ExerciseApiData) then) =
_$ExerciseApiDataCopyWithImpl<$Res, ExerciseApiData>;
@useResult
$Res call(
@@ -184,10 +178,9 @@ class _$ExerciseApiDataCopyWithImpl<$Res, $Val extends ExerciseApiData>
}
/// @nodoc
abstract class _$$ExerciseBaseDataImplCopyWith<$Res>
implements $ExerciseApiDataCopyWith<$Res> {
factory _$$ExerciseBaseDataImplCopyWith(_$ExerciseBaseDataImpl value,
$Res Function(_$ExerciseBaseDataImpl) then) =
abstract class _$$ExerciseBaseDataImplCopyWith<$Res> implements $ExerciseApiDataCopyWith<$Res> {
factory _$$ExerciseBaseDataImplCopyWith(
_$ExerciseBaseDataImpl value, $Res Function(_$ExerciseBaseDataImpl) then) =
__$$ExerciseBaseDataImplCopyWithImpl<$Res>;
@override
@useResult
@@ -213,8 +206,8 @@ abstract class _$$ExerciseBaseDataImplCopyWith<$Res>
class __$$ExerciseBaseDataImplCopyWithImpl<$Res>
extends _$ExerciseApiDataCopyWithImpl<$Res, _$ExerciseBaseDataImpl>
implements _$$ExerciseBaseDataImplCopyWith<$Res> {
__$$ExerciseBaseDataImplCopyWithImpl(_$ExerciseBaseDataImpl _value,
$Res Function(_$ExerciseBaseDataImpl) _then)
__$$ExerciseBaseDataImplCopyWithImpl(
_$ExerciseBaseDataImpl _value, $Res Function(_$ExerciseBaseDataImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseApiData
@@ -315,15 +308,13 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
@JsonKey(name: 'last_update_global') required this.lastUpdateGlobal,
required this.category,
required final List<Muscle> muscles,
@JsonKey(name: 'muscles_secondary')
required final List<Muscle> musclesSecondary,
@JsonKey(name: 'muscles_secondary') required final List<Muscle> musclesSecondary,
required final List<Equipment> equipment,
@JsonKey(name: 'exercises') required final List<Translation> translations,
required final List<ExerciseImage> images,
required final List<Video> videos,
@JsonKey(name: 'author_history') required final List<String> authors,
@JsonKey(name: 'total_authors_history')
required final List<String> authorsGlobal})
@JsonKey(name: 'total_authors_history') required final List<String> authorsGlobal})
: _muscles = muscles,
_musclesSecondary = musclesSecondary,
_equipment = equipment,
@@ -372,8 +363,7 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
@override
@JsonKey(name: 'muscles_secondary')
List<Muscle> get musclesSecondary {
if (_musclesSecondary is EqualUnmodifiableListView)
return _musclesSecondary;
if (_musclesSecondary is EqualUnmodifiableListView) return _musclesSecondary;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_musclesSecondary);
}
@@ -449,27 +439,20 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
other is _$ExerciseBaseDataImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.uuid, uuid) || other.uuid == uuid) &&
(identical(other.variationId, variationId) ||
other.variationId == variationId) &&
(identical(other.variationId, variationId) || other.variationId == variationId) &&
(identical(other.created, created) || other.created == created) &&
(identical(other.lastUpdate, lastUpdate) ||
other.lastUpdate == lastUpdate) &&
(identical(other.lastUpdate, lastUpdate) || other.lastUpdate == lastUpdate) &&
(identical(other.lastUpdateGlobal, lastUpdateGlobal) ||
other.lastUpdateGlobal == lastUpdateGlobal) &&
(identical(other.category, category) ||
other.category == category) &&
(identical(other.category, category) || other.category == category) &&
const DeepCollectionEquality().equals(other._muscles, _muscles) &&
const DeepCollectionEquality()
.equals(other._musclesSecondary, _musclesSecondary) &&
const DeepCollectionEquality()
.equals(other._equipment, _equipment) &&
const DeepCollectionEquality()
.equals(other._translations, _translations) &&
const DeepCollectionEquality().equals(other._musclesSecondary, _musclesSecondary) &&
const DeepCollectionEquality().equals(other._equipment, _equipment) &&
const DeepCollectionEquality().equals(other._translations, _translations) &&
const DeepCollectionEquality().equals(other._images, _images) &&
const DeepCollectionEquality().equals(other._videos, _videos) &&
const DeepCollectionEquality().equals(other._authors, _authors) &&
const DeepCollectionEquality()
.equals(other._authorsGlobal, _authorsGlobal));
const DeepCollectionEquality().equals(other._authorsGlobal, _authorsGlobal));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -498,8 +481,7 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
@override
@pragma('vm:prefer-inline')
_$$ExerciseBaseDataImplCopyWith<_$ExerciseBaseDataImpl> get copyWith =>
__$$ExerciseBaseDataImplCopyWithImpl<_$ExerciseBaseDataImpl>(
this, _$identity);
__$$ExerciseBaseDataImplCopyWithImpl<_$ExerciseBaseDataImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -511,27 +493,24 @@ class _$ExerciseBaseDataImpl implements _ExerciseBaseData {
abstract class _ExerciseBaseData implements ExerciseApiData {
factory _ExerciseBaseData(
{required final int id,
required final String uuid,
@JsonKey(name: 'variations') final int? variationId,
@JsonKey(name: 'created') required final DateTime created,
@JsonKey(name: 'last_update') required final DateTime lastUpdate,
@JsonKey(name: 'last_update_global')
required final DateTime lastUpdateGlobal,
required final ExerciseCategory category,
required final List<Muscle> muscles,
@JsonKey(name: 'muscles_secondary')
required final List<Muscle> musclesSecondary,
required final List<Equipment> equipment,
@JsonKey(name: 'exercises') required final List<Translation> translations,
required final List<ExerciseImage> images,
required final List<Video> videos,
@JsonKey(name: 'author_history') required final List<String> authors,
@JsonKey(name: 'total_authors_history')
required final List<String> authorsGlobal}) = _$ExerciseBaseDataImpl;
{required final int id,
required final String uuid,
@JsonKey(name: 'variations') final int? variationId,
@JsonKey(name: 'created') required final DateTime created,
@JsonKey(name: 'last_update') required final DateTime lastUpdate,
@JsonKey(name: 'last_update_global') required final DateTime lastUpdateGlobal,
required final ExerciseCategory category,
required final List<Muscle> muscles,
@JsonKey(name: 'muscles_secondary') required final List<Muscle> musclesSecondary,
required final List<Equipment> equipment,
@JsonKey(name: 'exercises') required final List<Translation> translations,
required final List<ExerciseImage> images,
required final List<Video> videos,
@JsonKey(name: 'author_history') required final List<String> authors,
@JsonKey(name: 'total_authors_history') required final List<String> authorsGlobal}) =
_$ExerciseBaseDataImpl;
factory _ExerciseBaseData.fromJson(Map<String, dynamic> json) =
_$ExerciseBaseDataImpl.fromJson;
factory _ExerciseBaseData.fromJson(Map<String, dynamic> json) = _$ExerciseBaseDataImpl.fromJson;
@override
int get id;
@@ -580,8 +559,7 @@ abstract class _ExerciseBaseData implements ExerciseApiData {
throw _privateConstructorUsedError;
}
ExerciseSearchDetails _$ExerciseSearchDetailsFromJson(
Map<String, dynamic> json) {
ExerciseSearchDetails _$ExerciseSearchDetailsFromJson(Map<String, dynamic> json) {
return _ExerciseSearchDetails.fromJson(json);
}
@@ -589,14 +567,12 @@ ExerciseSearchDetails _$ExerciseSearchDetailsFromJson(
mixin _$ExerciseSearchDetails {
// ignore: invalid_annotation_target
@JsonKey(name: 'id')
int get translationId =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
int get translationId => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'base_id')
int get exerciseId => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get category => throw _privateConstructorUsedError;
String? get image =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
String? get image => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'image_thumbnail')
String? get imageThumbnail => throw _privateConstructorUsedError;
@@ -612,8 +588,8 @@ mixin _$ExerciseSearchDetails {
/// @nodoc
abstract class $ExerciseSearchDetailsCopyWith<$Res> {
factory $ExerciseSearchDetailsCopyWith(ExerciseSearchDetails value,
$Res Function(ExerciseSearchDetails) then) =
factory $ExerciseSearchDetailsCopyWith(
ExerciseSearchDetails value, $Res Function(ExerciseSearchDetails) then) =
_$ExerciseSearchDetailsCopyWithImpl<$Res, ExerciseSearchDetails>;
@useResult
$Res call(
@@ -626,8 +602,7 @@ abstract class $ExerciseSearchDetailsCopyWith<$Res> {
}
/// @nodoc
class _$ExerciseSearchDetailsCopyWithImpl<$Res,
$Val extends ExerciseSearchDetails>
class _$ExerciseSearchDetailsCopyWithImpl<$Res, $Val extends ExerciseSearchDetails>
implements $ExerciseSearchDetailsCopyWith<$Res> {
_$ExerciseSearchDetailsCopyWithImpl(this._value, this._then);
@@ -681,8 +656,7 @@ class _$ExerciseSearchDetailsCopyWithImpl<$Res,
abstract class _$$ExerciseSearchDetailsImplCopyWith<$Res>
implements $ExerciseSearchDetailsCopyWith<$Res> {
factory _$$ExerciseSearchDetailsImplCopyWith(
_$ExerciseSearchDetailsImpl value,
$Res Function(_$ExerciseSearchDetailsImpl) then) =
_$ExerciseSearchDetailsImpl value, $Res Function(_$ExerciseSearchDetailsImpl) then) =
__$$ExerciseSearchDetailsImplCopyWithImpl<$Res>;
@override
@useResult
@@ -697,11 +671,10 @@ abstract class _$$ExerciseSearchDetailsImplCopyWith<$Res>
/// @nodoc
class __$$ExerciseSearchDetailsImplCopyWithImpl<$Res>
extends _$ExerciseSearchDetailsCopyWithImpl<$Res,
_$ExerciseSearchDetailsImpl>
extends _$ExerciseSearchDetailsCopyWithImpl<$Res, _$ExerciseSearchDetailsImpl>
implements _$$ExerciseSearchDetailsImplCopyWith<$Res> {
__$$ExerciseSearchDetailsImplCopyWithImpl(_$ExerciseSearchDetailsImpl _value,
$Res Function(_$ExerciseSearchDetailsImpl) _then)
__$$ExerciseSearchDetailsImplCopyWithImpl(
_$ExerciseSearchDetailsImpl _value, $Res Function(_$ExerciseSearchDetailsImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseSearchDetails
@@ -790,11 +763,9 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
other is _$ExerciseSearchDetailsImpl &&
(identical(other.translationId, translationId) ||
other.translationId == translationId) &&
(identical(other.exerciseId, exerciseId) ||
other.exerciseId == exerciseId) &&
(identical(other.exerciseId, exerciseId) || other.exerciseId == exerciseId) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.category, category) ||
other.category == category) &&
(identical(other.category, category) || other.category == category) &&
(identical(other.image, image) || other.image == image) &&
(identical(other.imageThumbnail, imageThumbnail) ||
other.imageThumbnail == imageThumbnail));
@@ -802,17 +773,16 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, translationId, exerciseId, name,
category, image, imageThumbnail);
int get hashCode =>
Object.hash(runtimeType, translationId, exerciseId, name, category, image, imageThumbnail);
/// Create a copy of ExerciseSearchDetails
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl>
get copyWith => __$$ExerciseSearchDetailsImplCopyWithImpl<
_$ExerciseSearchDetailsImpl>(this, _$identity);
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl> get copyWith =>
__$$ExerciseSearchDetailsImplCopyWithImpl<_$ExerciseSearchDetailsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -824,13 +794,13 @@ class _$ExerciseSearchDetailsImpl implements _ExerciseSearchDetails {
abstract class _ExerciseSearchDetails implements ExerciseSearchDetails {
factory _ExerciseSearchDetails(
{@JsonKey(name: 'id') required final int translationId,
@JsonKey(name: 'base_id') required final int exerciseId,
required final String name,
required final String category,
required final String? image,
@JsonKey(name: 'image_thumbnail')
required final String? imageThumbnail}) = _$ExerciseSearchDetailsImpl;
{@JsonKey(name: 'id') required final int translationId,
@JsonKey(name: 'base_id') required final int exerciseId,
required final String name,
required final String category,
required final String? image,
@JsonKey(name: 'image_thumbnail') required final String? imageThumbnail}) =
_$ExerciseSearchDetailsImpl;
factory _ExerciseSearchDetails.fromJson(Map<String, dynamic> json) =
_$ExerciseSearchDetailsImpl.fromJson;
@@ -856,8 +826,8 @@ abstract class _ExerciseSearchDetails implements ExerciseSearchDetails {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl>
get copyWith => throw _privateConstructorUsedError;
_$$ExerciseSearchDetailsImplCopyWith<_$ExerciseSearchDetailsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
ExerciseSearchEntry _$ExerciseSearchEntryFromJson(Map<String, dynamic> json) {
@@ -934,8 +904,8 @@ class _$ExerciseSearchEntryCopyWithImpl<$Res, $Val extends ExerciseSearchEntry>
/// @nodoc
abstract class _$$ExerciseSearchEntryImplCopyWith<$Res>
implements $ExerciseSearchEntryCopyWith<$Res> {
factory _$$ExerciseSearchEntryImplCopyWith(_$ExerciseSearchEntryImpl value,
$Res Function(_$ExerciseSearchEntryImpl) then) =
factory _$$ExerciseSearchEntryImplCopyWith(
_$ExerciseSearchEntryImpl value, $Res Function(_$ExerciseSearchEntryImpl) then) =
__$$ExerciseSearchEntryImplCopyWithImpl<$Res>;
@override
@useResult
@@ -949,8 +919,8 @@ abstract class _$$ExerciseSearchEntryImplCopyWith<$Res>
class __$$ExerciseSearchEntryImplCopyWithImpl<$Res>
extends _$ExerciseSearchEntryCopyWithImpl<$Res, _$ExerciseSearchEntryImpl>
implements _$$ExerciseSearchEntryImplCopyWith<$Res> {
__$$ExerciseSearchEntryImplCopyWithImpl(_$ExerciseSearchEntryImpl _value,
$Res Function(_$ExerciseSearchEntryImpl) _then)
__$$ExerciseSearchEntryImplCopyWithImpl(
_$ExerciseSearchEntryImpl _value, $Res Function(_$ExerciseSearchEntryImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseSearchEntry
@@ -1011,8 +981,7 @@ class _$ExerciseSearchEntryImpl implements _ExerciseSearchEntry {
@override
@pragma('vm:prefer-inline')
_$$ExerciseSearchEntryImplCopyWith<_$ExerciseSearchEntryImpl> get copyWith =>
__$$ExerciseSearchEntryImplCopyWithImpl<_$ExerciseSearchEntryImpl>(
this, _$identity);
__$$ExerciseSearchEntryImplCopyWithImpl<_$ExerciseSearchEntryImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -1049,8 +1018,7 @@ ExerciseApiSearch _$ExerciseApiSearchFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ExerciseApiSearch {
List<ExerciseSearchEntry> get suggestions =>
throw _privateConstructorUsedError;
List<ExerciseSearchEntry> get suggestions => throw _privateConstructorUsedError;
/// Serializes this ExerciseApiSearch to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -1058,8 +1026,7 @@ mixin _$ExerciseApiSearch {
/// Create a copy of ExerciseApiSearch
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ExerciseApiSearchCopyWith<ExerciseApiSearch> get copyWith =>
throw _privateConstructorUsedError;
$ExerciseApiSearchCopyWith<ExerciseApiSearch> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
@@ -1098,10 +1065,9 @@ class _$ExerciseApiSearchCopyWithImpl<$Res, $Val extends ExerciseApiSearch>
}
/// @nodoc
abstract class _$$ExerciseApiSearchImplCopyWith<$Res>
implements $ExerciseApiSearchCopyWith<$Res> {
factory _$$ExerciseApiSearchImplCopyWith(_$ExerciseApiSearchImpl value,
$Res Function(_$ExerciseApiSearchImpl) then) =
abstract class _$$ExerciseApiSearchImplCopyWith<$Res> implements $ExerciseApiSearchCopyWith<$Res> {
factory _$$ExerciseApiSearchImplCopyWith(
_$ExerciseApiSearchImpl value, $Res Function(_$ExerciseApiSearchImpl) then) =
__$$ExerciseApiSearchImplCopyWithImpl<$Res>;
@override
@useResult
@@ -1112,8 +1078,8 @@ abstract class _$$ExerciseApiSearchImplCopyWith<$Res>
class __$$ExerciseApiSearchImplCopyWithImpl<$Res>
extends _$ExerciseApiSearchCopyWithImpl<$Res, _$ExerciseApiSearchImpl>
implements _$$ExerciseApiSearchImplCopyWith<$Res> {
__$$ExerciseApiSearchImplCopyWithImpl(_$ExerciseApiSearchImpl _value,
$Res Function(_$ExerciseApiSearchImpl) _then)
__$$ExerciseApiSearchImplCopyWithImpl(
_$ExerciseApiSearchImpl _value, $Res Function(_$ExerciseApiSearchImpl) _then)
: super(_value, _then);
/// Create a copy of ExerciseApiSearch
@@ -1135,8 +1101,7 @@ class __$$ExerciseApiSearchImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
_$ExerciseApiSearchImpl(
{required final List<ExerciseSearchEntry> suggestions})
_$ExerciseApiSearchImpl({required final List<ExerciseSearchEntry> suggestions})
: _suggestions = suggestions;
factory _$ExerciseApiSearchImpl.fromJson(Map<String, dynamic> json) =>
@@ -1160,14 +1125,12 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ExerciseApiSearchImpl &&
const DeepCollectionEquality()
.equals(other._suggestions, _suggestions));
const DeepCollectionEquality().equals(other._suggestions, _suggestions));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_suggestions));
int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_suggestions));
/// Create a copy of ExerciseApiSearch
/// with the given fields replaced by the non-null parameter values.
@@ -1175,8 +1138,7 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
@override
@pragma('vm:prefer-inline')
_$$ExerciseApiSearchImplCopyWith<_$ExerciseApiSearchImpl> get copyWith =>
__$$ExerciseApiSearchImplCopyWithImpl<_$ExerciseApiSearchImpl>(
this, _$identity);
__$$ExerciseApiSearchImplCopyWithImpl<_$ExerciseApiSearchImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -1187,12 +1149,10 @@ class _$ExerciseApiSearchImpl implements _ExerciseApiSearch {
}
abstract class _ExerciseApiSearch implements ExerciseApiSearch {
factory _ExerciseApiSearch(
{required final List<ExerciseSearchEntry> suggestions}) =
factory _ExerciseApiSearch({required final List<ExerciseSearchEntry> suggestions}) =
_$ExerciseApiSearchImpl;
factory _ExerciseApiSearch.fromJson(Map<String, dynamic> json) =
_$ExerciseApiSearchImpl.fromJson;
factory _ExerciseApiSearch.fromJson(Map<String, dynamic> json) = _$ExerciseApiSearchImpl.fromJson;
@override
List<ExerciseSearchEntry> get suggestions;

View File

@@ -6,8 +6,7 @@ part of 'exercise_api.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(Map<String, dynamic> json) =>
_$ExerciseBaseDataImpl(
id: (json['id'] as num).toInt(),
uuid: json['uuid'] as String,
@@ -15,8 +14,7 @@ _$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(
created: DateTime.parse(json['created'] as String),
lastUpdate: DateTime.parse(json['last_update'] as String),
lastUpdateGlobal: DateTime.parse(json['last_update_global'] as String),
category:
ExerciseCategory.fromJson(json['category'] as Map<String, dynamic>),
category: ExerciseCategory.fromJson(json['category'] as Map<String, dynamic>),
muscles: (json['muscles'] as List<dynamic>)
.map((e) => Muscle.fromJson(e as Map<String, dynamic>))
.toList(),
@@ -35,16 +33,12 @@ _$ExerciseBaseDataImpl _$$ExerciseBaseDataImplFromJson(
videos: (json['videos'] as List<dynamic>)
.map((e) => Video.fromJson(e as Map<String, dynamic>))
.toList(),
authors: (json['author_history'] as List<dynamic>)
.map((e) => e as String)
.toList(),
authorsGlobal: (json['total_authors_history'] as List<dynamic>)
.map((e) => e as String)
.toList(),
authors: (json['author_history'] as List<dynamic>).map((e) => e as String).toList(),
authorsGlobal:
(json['total_authors_history'] as List<dynamic>).map((e) => e as String).toList(),
);
Map<String, dynamic> _$$ExerciseBaseDataImplToJson(
_$ExerciseBaseDataImpl instance) =>
Map<String, dynamic> _$$ExerciseBaseDataImplToJson(_$ExerciseBaseDataImpl instance) =>
<String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
@@ -63,8 +57,7 @@ Map<String, dynamic> _$$ExerciseBaseDataImplToJson(
'total_authors_history': instance.authorsGlobal,
};
_$ExerciseSearchDetailsImpl _$$ExerciseSearchDetailsImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseSearchDetailsImpl _$$ExerciseSearchDetailsImplFromJson(Map<String, dynamic> json) =>
_$ExerciseSearchDetailsImpl(
translationId: (json['id'] as num).toInt(),
exerciseId: (json['base_id'] as num).toInt(),
@@ -74,8 +67,7 @@ _$ExerciseSearchDetailsImpl _$$ExerciseSearchDetailsImplFromJson(
imageThumbnail: json['image_thumbnail'] as String?,
);
Map<String, dynamic> _$$ExerciseSearchDetailsImplToJson(
_$ExerciseSearchDetailsImpl instance) =>
Map<String, dynamic> _$$ExerciseSearchDetailsImplToJson(_$ExerciseSearchDetailsImpl instance) =>
<String, dynamic>{
'id': instance.translationId,
'base_id': instance.exerciseId,
@@ -85,31 +77,26 @@ Map<String, dynamic> _$$ExerciseSearchDetailsImplToJson(
'image_thumbnail': instance.imageThumbnail,
};
_$ExerciseSearchEntryImpl _$$ExerciseSearchEntryImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseSearchEntryImpl _$$ExerciseSearchEntryImplFromJson(Map<String, dynamic> json) =>
_$ExerciseSearchEntryImpl(
value: json['value'] as String,
data:
ExerciseSearchDetails.fromJson(json['data'] as Map<String, dynamic>),
data: ExerciseSearchDetails.fromJson(json['data'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$ExerciseSearchEntryImplToJson(
_$ExerciseSearchEntryImpl instance) =>
Map<String, dynamic> _$$ExerciseSearchEntryImplToJson(_$ExerciseSearchEntryImpl instance) =>
<String, dynamic>{
'value': instance.value,
'data': instance.data,
};
_$ExerciseApiSearchImpl _$$ExerciseApiSearchImplFromJson(
Map<String, dynamic> json) =>
_$ExerciseApiSearchImpl _$$ExerciseApiSearchImplFromJson(Map<String, dynamic> json) =>
_$ExerciseApiSearchImpl(
suggestions: (json['suggestions'] as List<dynamic>)
.map((e) => ExerciseSearchEntry.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$$ExerciseApiSearchImplToJson(
_$ExerciseApiSearchImpl instance) =>
Map<String, dynamic> _$$ExerciseApiSearchImplToJson(_$ExerciseApiSearchImpl instance) =>
<String, dynamic>{
'suggestions': instance.suggestions,
};

View File

@@ -20,8 +20,7 @@ ExerciseImage _$ExerciseImageFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) =>
<String, dynamic>{
Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) => <String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
'exercise_base': instance.exerciseBaseId,

View File

@@ -14,8 +14,7 @@ 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');
IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(
Map<String, dynamic> json) {
IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(Map<String, dynamic> json) {
return _IngredientApiSearchDetails.fromJson(json);
}
@@ -23,8 +22,7 @@ IngredientApiSearchDetails _$IngredientApiSearchDetailsFromJson(
mixin _$IngredientApiSearchDetails {
int get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get image =>
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
String? get image => throw _privateConstructorUsedError; // ignore: invalid_annotation_target
@JsonKey(name: 'image_thumbnail')
String? get imageThumbnail => throw _privateConstructorUsedError;
@@ -34,16 +32,15 @@ mixin _$IngredientApiSearchDetails {
/// Create a copy of IngredientApiSearchDetails
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$IngredientApiSearchDetailsCopyWith<IngredientApiSearchDetails>
get copyWith => throw _privateConstructorUsedError;
$IngredientApiSearchDetailsCopyWith<IngredientApiSearchDetails> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $IngredientApiSearchDetailsCopyWith<$Res> {
factory $IngredientApiSearchDetailsCopyWith(IngredientApiSearchDetails value,
$Res Function(IngredientApiSearchDetails) then) =
_$IngredientApiSearchDetailsCopyWithImpl<$Res,
IngredientApiSearchDetails>;
factory $IngredientApiSearchDetailsCopyWith(
IngredientApiSearchDetails value, $Res Function(IngredientApiSearchDetails) then) =
_$IngredientApiSearchDetailsCopyWithImpl<$Res, IngredientApiSearchDetails>;
@useResult
$Res call(
{int id,
@@ -53,8 +50,7 @@ abstract class $IngredientApiSearchDetailsCopyWith<$Res> {
}
/// @nodoc
class _$IngredientApiSearchDetailsCopyWithImpl<$Res,
$Val extends IngredientApiSearchDetails>
class _$IngredientApiSearchDetailsCopyWithImpl<$Res, $Val extends IngredientApiSearchDetails>
implements $IngredientApiSearchDetailsCopyWith<$Res> {
_$IngredientApiSearchDetailsCopyWithImpl(this._value, this._then);
@@ -97,8 +93,7 @@ class _$IngredientApiSearchDetailsCopyWithImpl<$Res,
/// @nodoc
abstract class _$$IngredientApiSearchDetailsImplCopyWith<$Res>
implements $IngredientApiSearchDetailsCopyWith<$Res> {
factory _$$IngredientApiSearchDetailsImplCopyWith(
_$IngredientApiSearchDetailsImpl value,
factory _$$IngredientApiSearchDetailsImplCopyWith(_$IngredientApiSearchDetailsImpl value,
$Res Function(_$IngredientApiSearchDetailsImpl) then) =
__$$IngredientApiSearchDetailsImplCopyWithImpl<$Res>;
@override
@@ -112,11 +107,9 @@ abstract class _$$IngredientApiSearchDetailsImplCopyWith<$Res>
/// @nodoc
class __$$IngredientApiSearchDetailsImplCopyWithImpl<$Res>
extends _$IngredientApiSearchDetailsCopyWithImpl<$Res,
_$IngredientApiSearchDetailsImpl>
extends _$IngredientApiSearchDetailsCopyWithImpl<$Res, _$IngredientApiSearchDetailsImpl>
implements _$$IngredientApiSearchDetailsImplCopyWith<$Res> {
__$$IngredientApiSearchDetailsImplCopyWithImpl(
_$IngredientApiSearchDetailsImpl _value,
__$$IngredientApiSearchDetailsImplCopyWithImpl(_$IngredientApiSearchDetailsImpl _value,
$Res Function(_$IngredientApiSearchDetailsImpl) _then)
: super(_value, _then);
@@ -160,8 +153,7 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
required this.image,
@JsonKey(name: 'image_thumbnail') required this.imageThumbnail});
factory _$IngredientApiSearchDetailsImpl.fromJson(
Map<String, dynamic> json) =>
factory _$IngredientApiSearchDetailsImpl.fromJson(Map<String, dynamic> json) =>
_$$IngredientApiSearchDetailsImplFromJson(json);
@override
@@ -201,9 +193,9 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl>
get copyWith => __$$IngredientApiSearchDetailsImplCopyWithImpl<
_$IngredientApiSearchDetailsImpl>(this, _$identity);
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl> get copyWith =>
__$$IngredientApiSearchDetailsImplCopyWithImpl<_$IngredientApiSearchDetailsImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -213,14 +205,12 @@ class _$IngredientApiSearchDetailsImpl implements _IngredientApiSearchDetails {
}
}
abstract class _IngredientApiSearchDetails
implements IngredientApiSearchDetails {
abstract class _IngredientApiSearchDetails implements IngredientApiSearchDetails {
factory _IngredientApiSearchDetails(
{required final int id,
required final String name,
required final String? image,
@JsonKey(name: 'image_thumbnail')
required final String? imageThumbnail}) =
@JsonKey(name: 'image_thumbnail') required final String? imageThumbnail}) =
_$IngredientApiSearchDetailsImpl;
factory _IngredientApiSearchDetails.fromJson(Map<String, dynamic> json) =
@@ -240,12 +230,11 @@ abstract class _IngredientApiSearchDetails
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl>
get copyWith => throw _privateConstructorUsedError;
_$$IngredientApiSearchDetailsImplCopyWith<_$IngredientApiSearchDetailsImpl> get copyWith =>
throw _privateConstructorUsedError;
}
IngredientApiSearchEntry _$IngredientApiSearchEntryFromJson(
Map<String, dynamic> json) {
IngredientApiSearchEntry _$IngredientApiSearchEntryFromJson(Map<String, dynamic> json) {
return _IngredientApiSearchEntry.fromJson(json);
}
@@ -266,8 +255,8 @@ mixin _$IngredientApiSearchEntry {
/// @nodoc
abstract class $IngredientApiSearchEntryCopyWith<$Res> {
factory $IngredientApiSearchEntryCopyWith(IngredientApiSearchEntry value,
$Res Function(IngredientApiSearchEntry) then) =
factory $IngredientApiSearchEntryCopyWith(
IngredientApiSearchEntry value, $Res Function(IngredientApiSearchEntry) then) =
_$IngredientApiSearchEntryCopyWithImpl<$Res, IngredientApiSearchEntry>;
@useResult
$Res call({String value, IngredientApiSearchDetails data});
@@ -276,8 +265,7 @@ abstract class $IngredientApiSearchEntryCopyWith<$Res> {
}
/// @nodoc
class _$IngredientApiSearchEntryCopyWithImpl<$Res,
$Val extends IngredientApiSearchEntry>
class _$IngredientApiSearchEntryCopyWithImpl<$Res, $Val extends IngredientApiSearchEntry>
implements $IngredientApiSearchEntryCopyWith<$Res> {
_$IngredientApiSearchEntryCopyWithImpl(this._value, this._then);
@@ -320,8 +308,7 @@ class _$IngredientApiSearchEntryCopyWithImpl<$Res,
/// @nodoc
abstract class _$$IngredientApiSearchEntryImplCopyWith<$Res>
implements $IngredientApiSearchEntryCopyWith<$Res> {
factory _$$IngredientApiSearchEntryImplCopyWith(
_$IngredientApiSearchEntryImpl value,
factory _$$IngredientApiSearchEntryImplCopyWith(_$IngredientApiSearchEntryImpl value,
$Res Function(_$IngredientApiSearchEntryImpl) then) =
__$$IngredientApiSearchEntryImplCopyWithImpl<$Res>;
@override
@@ -334,12 +321,10 @@ abstract class _$$IngredientApiSearchEntryImplCopyWith<$Res>
/// @nodoc
class __$$IngredientApiSearchEntryImplCopyWithImpl<$Res>
extends _$IngredientApiSearchEntryCopyWithImpl<$Res,
_$IngredientApiSearchEntryImpl>
extends _$IngredientApiSearchEntryCopyWithImpl<$Res, _$IngredientApiSearchEntryImpl>
implements _$$IngredientApiSearchEntryImplCopyWith<$Res> {
__$$IngredientApiSearchEntryImplCopyWithImpl(
_$IngredientApiSearchEntryImpl _value,
$Res Function(_$IngredientApiSearchEntryImpl) _then)
_$IngredientApiSearchEntryImpl _value, $Res Function(_$IngredientApiSearchEntryImpl) _then)
: super(_value, _then);
/// Create a copy of IngredientApiSearchEntry
@@ -399,9 +384,9 @@ class _$IngredientApiSearchEntryImpl implements _IngredientApiSearchEntry {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl>
get copyWith => __$$IngredientApiSearchEntryImplCopyWithImpl<
_$IngredientApiSearchEntryImpl>(this, _$identity);
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl> get copyWith =>
__$$IngredientApiSearchEntryImplCopyWithImpl<_$IngredientApiSearchEntryImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -413,9 +398,8 @@ class _$IngredientApiSearchEntryImpl implements _IngredientApiSearchEntry {
abstract class _IngredientApiSearchEntry implements IngredientApiSearchEntry {
factory _IngredientApiSearchEntry(
{required final String value,
required final IngredientApiSearchDetails data}) =
_$IngredientApiSearchEntryImpl;
{required final String value,
required final IngredientApiSearchDetails data}) = _$IngredientApiSearchEntryImpl;
factory _IngredientApiSearchEntry.fromJson(Map<String, dynamic> json) =
_$IngredientApiSearchEntryImpl.fromJson;
@@ -429,8 +413,8 @@ abstract class _IngredientApiSearchEntry implements IngredientApiSearchEntry {
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl>
get copyWith => throw _privateConstructorUsedError;
_$$IngredientApiSearchEntryImplCopyWith<_$IngredientApiSearchEntryImpl> get copyWith =>
throw _privateConstructorUsedError;
}
IngredientApiSearch _$IngredientApiSearchFromJson(Map<String, dynamic> json) {
@@ -439,8 +423,7 @@ IngredientApiSearch _$IngredientApiSearchFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$IngredientApiSearch {
List<IngredientApiSearchEntry> get suggestions =>
throw _privateConstructorUsedError;
List<IngredientApiSearchEntry> get suggestions => throw _privateConstructorUsedError;
/// Serializes this IngredientApiSearch to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -490,8 +473,8 @@ class _$IngredientApiSearchCopyWithImpl<$Res, $Val extends IngredientApiSearch>
/// @nodoc
abstract class _$$IngredientApiSearchImplCopyWith<$Res>
implements $IngredientApiSearchCopyWith<$Res> {
factory _$$IngredientApiSearchImplCopyWith(_$IngredientApiSearchImpl value,
$Res Function(_$IngredientApiSearchImpl) then) =
factory _$$IngredientApiSearchImplCopyWith(
_$IngredientApiSearchImpl value, $Res Function(_$IngredientApiSearchImpl) then) =
__$$IngredientApiSearchImplCopyWithImpl<$Res>;
@override
@useResult
@@ -502,8 +485,8 @@ abstract class _$$IngredientApiSearchImplCopyWith<$Res>
class __$$IngredientApiSearchImplCopyWithImpl<$Res>
extends _$IngredientApiSearchCopyWithImpl<$Res, _$IngredientApiSearchImpl>
implements _$$IngredientApiSearchImplCopyWith<$Res> {
__$$IngredientApiSearchImplCopyWithImpl(_$IngredientApiSearchImpl _value,
$Res Function(_$IngredientApiSearchImpl) _then)
__$$IngredientApiSearchImplCopyWithImpl(
_$IngredientApiSearchImpl _value, $Res Function(_$IngredientApiSearchImpl) _then)
: super(_value, _then);
/// Create a copy of IngredientApiSearch
@@ -525,8 +508,7 @@ class __$$IngredientApiSearchImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$IngredientApiSearchImpl implements _IngredientApiSearch {
_$IngredientApiSearchImpl(
{required final List<IngredientApiSearchEntry> suggestions})
_$IngredientApiSearchImpl({required final List<IngredientApiSearchEntry> suggestions})
: _suggestions = suggestions;
factory _$IngredientApiSearchImpl.fromJson(Map<String, dynamic> json) =>
@@ -550,14 +532,12 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$IngredientApiSearchImpl &&
const DeepCollectionEquality()
.equals(other._suggestions, _suggestions));
const DeepCollectionEquality().equals(other._suggestions, _suggestions));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_suggestions));
int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_suggestions));
/// Create a copy of IngredientApiSearch
/// with the given fields replaced by the non-null parameter values.
@@ -565,8 +545,7 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
@override
@pragma('vm:prefer-inline')
_$$IngredientApiSearchImplCopyWith<_$IngredientApiSearchImpl> get copyWith =>
__$$IngredientApiSearchImplCopyWithImpl<_$IngredientApiSearchImpl>(
this, _$identity);
__$$IngredientApiSearchImplCopyWithImpl<_$IngredientApiSearchImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -577,8 +556,7 @@ class _$IngredientApiSearchImpl implements _IngredientApiSearch {
}
abstract class _IngredientApiSearch implements IngredientApiSearch {
factory _IngredientApiSearch(
{required final List<IngredientApiSearchEntry> suggestions}) =
factory _IngredientApiSearch({required final List<IngredientApiSearchEntry> suggestions}) =
_$IngredientApiSearchImpl;
factory _IngredientApiSearch.fromJson(Map<String, dynamic> json) =

View File

@@ -24,12 +24,10 @@ Map<String, dynamic> _$$IngredientApiSearchDetailsImplToJson(
'image_thumbnail': instance.imageThumbnail,
};
_$IngredientApiSearchEntryImpl _$$IngredientApiSearchEntryImplFromJson(
Map<String, dynamic> json) =>
_$IngredientApiSearchEntryImpl _$$IngredientApiSearchEntryImplFromJson(Map<String, dynamic> json) =>
_$IngredientApiSearchEntryImpl(
value: json['value'] as String,
data: IngredientApiSearchDetails.fromJson(
json['data'] as Map<String, dynamic>),
data: IngredientApiSearchDetails.fromJson(json['data'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$IngredientApiSearchEntryImplToJson(
@@ -39,17 +37,14 @@ Map<String, dynamic> _$$IngredientApiSearchEntryImplToJson(
'data': instance.data,
};
_$IngredientApiSearchImpl _$$IngredientApiSearchImplFromJson(
Map<String, dynamic> json) =>
_$IngredientApiSearchImpl _$$IngredientApiSearchImplFromJson(Map<String, dynamic> json) =>
_$IngredientApiSearchImpl(
suggestions: (json['suggestions'] as List<dynamic>)
.map((e) =>
IngredientApiSearchEntry.fromJson(e as Map<String, dynamic>))
.map((e) => IngredientApiSearchEntry.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$$IngredientApiSearchImplToJson(
_$IngredientApiSearchImpl instance) =>
Map<String, dynamic> _$$IngredientApiSearchImplToJson(_$IngredientApiSearchImpl instance) =>
<String, dynamic>{
'suggestions': instance.suggestions,
};

View File

@@ -22,9 +22,7 @@ Translation _$TranslationFromJson(Map<String, dynamic> json) {
return Translation(
id: (json['id'] as num?)?.toInt(),
uuid: json['uuid'] as String?,
created: json['created'] == null
? null
: DateTime.parse(json['created'] as String),
created: json['created'] == null ? null : DateTime.parse(json['created'] as String),
name: json['name'] as String,
description: json['description'] as String,
exerciseId: (json['exercise_base'] as num?)?.toInt(),
@@ -38,8 +36,7 @@ Translation _$TranslationFromJson(Map<String, dynamic> json) {
.toList();
}
Map<String, dynamic> _$TranslationToJson(Translation instance) =>
<String, dynamic>{
Map<String, dynamic> _$TranslationToJson(Translation instance) => <String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
'language': instance.languageId,

View File

@@ -22,9 +22,7 @@ MeasurementCategory _$MeasurementCategoryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$MeasurementCategoryToJson(
MeasurementCategory instance) =>
<String, dynamic>{
Map<String, dynamic> _$MeasurementCategoryToJson(MeasurementCategory instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
'unit': instance.unit,

View File

@@ -20,8 +20,7 @@ MeasurementEntry _$MeasurementEntryFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) =>
<String, dynamic>{
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) => <String, dynamic>{
'id': instance.id,
'category': instance.category,
'date': toDate(instance.date),

View File

@@ -51,8 +51,7 @@ Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$IngredientToJson(Ingredient instance) =>
<String, dynamic>{
Map<String, dynamic> _$IngredientToJson(Ingredient instance) => <String, dynamic>{
'id': instance.id,
'remote_id': instance.remoteId,
'source_name': instance.sourceName,

View File

@@ -38,8 +38,7 @@ IngredientImage _$IngredientImageFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$IngredientImageToJson(IngredientImage instance) =>
<String, dynamic>{
Map<String, dynamic> _$IngredientImageToJson(IngredientImage instance) => <String, dynamic>{
'id': instance.id,
'uuid': instance.uuid,
'ingredient_id': instance.ingredientId,

View File

@@ -13,16 +13,14 @@ IngredientWeightUnit _$IngredientWeightUnitFromJson(Map<String, dynamic> json) {
);
return IngredientWeightUnit(
id: (json['id'] as num).toInt(),
weightUnit:
WeightUnit.fromJson(json['weight_unit'] as Map<String, dynamic>),
weightUnit: WeightUnit.fromJson(json['weight_unit'] as Map<String, dynamic>),
ingredient: Ingredient.fromJson(json['ingredient'] as Map<String, dynamic>),
grams: (json['grams'] as num).toInt(),
amount: (json['amount'] as num).toDouble(),
);
}
Map<String, dynamic> _$IngredientWeightUnitToJson(
IngredientWeightUnit instance) =>
Map<String, dynamic> _$IngredientWeightUnitToJson(IngredientWeightUnit instance) =>
<String, dynamic>{
'id': instance.id,
'weight_unit': instance.weightUnit,

View File

@@ -9,14 +9,7 @@ part of 'log.dart';
Log _$LogFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
requiredKeys: const [
'id',
'plan',
'datetime',
'ingredient',
'weight_unit',
'amount'
],
requiredKeys: const ['id', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount'],
);
return Log(
id: (json['id'] as num?)?.toInt(),

View File

@@ -34,8 +34,7 @@ NutritionalPlan _$NutritionalPlanFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) =>
<String, dynamic>{
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) => <String, dynamic>{
'id': instance.id,
'description': instance.description,
'creation_date': toDate(instance.creationDate),

View File

@@ -17,8 +17,7 @@ WeightUnit _$WeightUnitFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) =>
<String, dynamic>{
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -9,13 +9,7 @@ part of 'profile.dart';
Profile _$ProfileFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
requiredKeys: const [
'username',
'email_verified',
'is_trustworthy',
'weight_unit',
'email'
],
requiredKeys: const ['username', 'email_verified', 'is_trustworthy', 'weight_unit', 'email'],
);
return Profile(
username: json['username'] as String,

View File

@@ -15,8 +15,7 @@ Day _$DayFromJson(Map<String, dynamic> json) {
..id = (json['id'] as num?)?.toInt()
..workoutId = (json['training'] as num).toInt()
..description = json['description'] as String
..daysOfWeek =
(json['day'] as List<dynamic>).map((e) => (e as num).toInt()).toList();
..daysOfWeek = (json['day'] as List<dynamic>).map((e) => (e as num).toInt()).toList();
}
Map<String, dynamic> _$DayToJson(Day instance) => <String, dynamic>{

View File

@@ -17,8 +17,7 @@ RepetitionUnit _$RepetitionUnitFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$RepetitionUnitToJson(RepetitionUnit instance) =>
<String, dynamic>{
Map<String, dynamic> _$RepetitionUnitToJson(RepetitionUnit instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -9,14 +9,7 @@ part of 'session.dart';
WorkoutSession _$WorkoutSessionFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
requiredKeys: const [
'id',
'workout',
'date',
'impression',
'time_start',
'time_end'
],
requiredKeys: const ['id', 'workout', 'date', 'impression', 'time_start', 'time_end'],
);
return WorkoutSession()
..id = (json['id'] as num?)?.toInt()
@@ -28,8 +21,7 @@ WorkoutSession _$WorkoutSessionFromJson(Map<String, dynamic> json) {
..timeEnd = stringToTime(json['time_end'] as String?);
}
Map<String, dynamic> _$WorkoutSessionToJson(WorkoutSession instance) =>
<String, dynamic>{
Map<String, dynamic> _$WorkoutSessionToJson(WorkoutSession instance) => <String, dynamic>{
'id': instance.id,
'workout': instance.workoutId,
'date': toDate(instance.date),

View File

@@ -17,8 +17,7 @@ WeightUnit _$WeightUnitFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) =>
<String, dynamic>{
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) => <String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -19,8 +19,7 @@ WorkoutPlan _$WorkoutPlanFromJson(Map<String, dynamic> json) {
);
}
Map<String, dynamic> _$WorkoutPlanToJson(WorkoutPlan instance) =>
<String, dynamic>{
Map<String, dynamic> _$WorkoutPlanToJson(WorkoutPlan instance) => <String, dynamic>{
'id': instance.id,
'creation_date': instance.creationDate.toIso8601String(),
'name': instance.name,