mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Merge branch 'master' into nutrition-plan-stats
# Conflicts: # lib/models/nutrition/nutritional_plan.g.dart # lib/widgets/measurements/charts.dart # lib/widgets/measurements/entries.dart # lib/widgets/weight/weight_overview.dart
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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
|
||||
|
||||
@@ -217,6 +216,252 @@ class _$ExerciseApiDataCopyWithImpl<$Res> implements $ExerciseApiDataCopyWith<$R
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [ExerciseApiData].
|
||||
extension ExerciseApiDataPatterns on ExerciseApiData {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ExerciseBaseData value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseBaseData() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ExerciseBaseData value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseBaseData():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ExerciseBaseData value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseBaseData() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(
|
||||
int id,
|
||||
String uuid,
|
||||
@JsonKey(name: 'variations') int? variationId,
|
||||
@JsonKey(name: 'created') DateTime created,
|
||||
@JsonKey(name: 'last_update') DateTime lastUpdate,
|
||||
@JsonKey(name: 'last_update_global') DateTime lastUpdateGlobal,
|
||||
ExerciseCategory category,
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations', defaultValue: []) List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@JsonKey(name: 'total_authors_history') List<String> authorsGlobal)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseBaseData() when $default != null:
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.uuid,
|
||||
_that.variationId,
|
||||
_that.created,
|
||||
_that.lastUpdate,
|
||||
_that.lastUpdateGlobal,
|
||||
_that.category,
|
||||
_that.muscles,
|
||||
_that.musclesSecondary,
|
||||
_that.equipment,
|
||||
_that.translations,
|
||||
_that.images,
|
||||
_that.videos,
|
||||
_that.authors,
|
||||
_that.authorsGlobal);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(
|
||||
int id,
|
||||
String uuid,
|
||||
@JsonKey(name: 'variations') int? variationId,
|
||||
@JsonKey(name: 'created') DateTime created,
|
||||
@JsonKey(name: 'last_update') DateTime lastUpdate,
|
||||
@JsonKey(name: 'last_update_global') DateTime lastUpdateGlobal,
|
||||
ExerciseCategory category,
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations', defaultValue: []) List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@JsonKey(name: 'total_authors_history') List<String> authorsGlobal)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseBaseData():
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.uuid,
|
||||
_that.variationId,
|
||||
_that.created,
|
||||
_that.lastUpdate,
|
||||
_that.lastUpdateGlobal,
|
||||
_that.category,
|
||||
_that.muscles,
|
||||
_that.musclesSecondary,
|
||||
_that.equipment,
|
||||
_that.translations,
|
||||
_that.images,
|
||||
_that.videos,
|
||||
_that.authors,
|
||||
_that.authorsGlobal);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(
|
||||
int id,
|
||||
String uuid,
|
||||
@JsonKey(name: 'variations') int? variationId,
|
||||
@JsonKey(name: 'created') DateTime created,
|
||||
@JsonKey(name: 'last_update') DateTime lastUpdate,
|
||||
@JsonKey(name: 'last_update_global') DateTime lastUpdateGlobal,
|
||||
ExerciseCategory category,
|
||||
List<Muscle> muscles,
|
||||
@JsonKey(name: 'muscles_secondary') List<Muscle> musclesSecondary,
|
||||
List<Equipment> equipment,
|
||||
@JsonKey(name: 'translations', defaultValue: []) List<Translation> translations,
|
||||
List<ExerciseImage> images,
|
||||
List<Video> videos,
|
||||
@JsonKey(name: 'author_history') List<String> authors,
|
||||
@JsonKey(name: 'total_authors_history') List<String> authorsGlobal)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseBaseData() when $default != null:
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.uuid,
|
||||
_that.variationId,
|
||||
_that.created,
|
||||
_that.lastUpdate,
|
||||
_that.lastUpdateGlobal,
|
||||
_that.category,
|
||||
_that.muscles,
|
||||
_that.musclesSecondary,
|
||||
_that.equipment,
|
||||
_that.translations,
|
||||
_that.images,
|
||||
_that.videos,
|
||||
_that.authors,
|
||||
_that.authorsGlobal);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _ExerciseBaseData implements ExerciseApiData {
|
||||
@@ -642,6 +887,183 @@ class _$ExerciseSearchDetailsCopyWithImpl<$Res> implements $ExerciseSearchDetail
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [ExerciseSearchDetails].
|
||||
extension ExerciseSearchDetailsPatterns on ExerciseSearchDetails {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ExerciseSearchDetails value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchDetails() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ExerciseSearchDetails value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchDetails():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ExerciseSearchDetails value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchDetails() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(
|
||||
@JsonKey(name: 'id') int translationId,
|
||||
@JsonKey(name: 'base_id') int exerciseId,
|
||||
String name,
|
||||
String category,
|
||||
String? image,
|
||||
@JsonKey(name: 'image_thumbnail') String? imageThumbnail)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchDetails() when $default != null:
|
||||
return $default(_that.translationId, _that.exerciseId, _that.name, _that.category,
|
||||
_that.image, _that.imageThumbnail);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(
|
||||
@JsonKey(name: 'id') int translationId,
|
||||
@JsonKey(name: 'base_id') int exerciseId,
|
||||
String name,
|
||||
String category,
|
||||
String? image,
|
||||
@JsonKey(name: 'image_thumbnail') String? imageThumbnail)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchDetails():
|
||||
return $default(_that.translationId, _that.exerciseId, _that.name, _that.category,
|
||||
_that.image, _that.imageThumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(
|
||||
@JsonKey(name: 'id') int translationId,
|
||||
@JsonKey(name: 'base_id') int exerciseId,
|
||||
String name,
|
||||
String category,
|
||||
String? image,
|
||||
@JsonKey(name: 'image_thumbnail') String? imageThumbnail)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchDetails() when $default != null:
|
||||
return $default(_that.translationId, _that.exerciseId, _that.name, _that.category,
|
||||
_that.image, _that.imageThumbnail);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _ExerciseSearchDetails implements ExerciseSearchDetails {
|
||||
@@ -864,6 +1286,159 @@ class _$ExerciseSearchEntryCopyWithImpl<$Res> implements $ExerciseSearchEntryCop
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [ExerciseSearchEntry].
|
||||
extension ExerciseSearchEntryPatterns on ExerciseSearchEntry {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ExerciseSearchEntry value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchEntry() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ExerciseSearchEntry value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchEntry():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ExerciseSearchEntry value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchEntry() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(String value, ExerciseSearchDetails data)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchEntry() when $default != null:
|
||||
return $default(_that.value, _that.data);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(String value, ExerciseSearchDetails data) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchEntry():
|
||||
return $default(_that.value, _that.data);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(String value, ExerciseSearchDetails data)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseSearchEntry() when $default != null:
|
||||
return $default(_that.value, _that.data);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _ExerciseSearchEntry implements ExerciseSearchEntry {
|
||||
@@ -1026,6 +1601,159 @@ class _$ExerciseApiSearchCopyWithImpl<$Res> implements $ExerciseApiSearchCopyWit
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [ExerciseApiSearch].
|
||||
extension ExerciseApiSearchPatterns on ExerciseApiSearch {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ExerciseApiSearch value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseApiSearch() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ExerciseApiSearch value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseApiSearch():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ExerciseApiSearch value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseApiSearch() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(List<ExerciseSearchEntry> suggestions)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseApiSearch() when $default != null:
|
||||
return $default(_that.suggestions);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(List<ExerciseSearchEntry> suggestions) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseApiSearch():
|
||||
return $default(_that.suggestions);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(List<ExerciseSearchEntry> suggestions)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ExerciseApiSearch() when $default != null:
|
||||
return $default(_that.suggestions);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _ExerciseApiSearch implements ExerciseApiSearch {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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
|
||||
|
||||
@@ -106,6 +105,165 @@ class _$IngredientApiSearchDetailsCopyWithImpl<$Res>
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [IngredientApiSearchDetails].
|
||||
extension IngredientApiSearchDetailsPatterns on IngredientApiSearchDetails {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_IngredientApiSearchDetails value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchDetails() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_IngredientApiSearchDetails value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchDetails():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_IngredientApiSearchDetails value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchDetails() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(int id, String name, String? image,
|
||||
@JsonKey(name: 'image_thumbnail') String? imageThumbnail)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchDetails() when $default != null:
|
||||
return $default(_that.id, _that.name, _that.image, _that.imageThumbnail);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(int id, String name, String? image,
|
||||
@JsonKey(name: 'image_thumbnail') String? imageThumbnail)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchDetails():
|
||||
return $default(_that.id, _that.name, _that.image, _that.imageThumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(int id, String name, String? image,
|
||||
@JsonKey(name: 'image_thumbnail') String? imageThumbnail)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchDetails() when $default != null:
|
||||
return $default(_that.id, _that.name, _that.image, _that.imageThumbnail);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _IngredientApiSearchDetails implements IngredientApiSearchDetails {
|
||||
@@ -304,6 +462,159 @@ class _$IngredientApiSearchEntryCopyWithImpl<$Res>
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [IngredientApiSearchEntry].
|
||||
extension IngredientApiSearchEntryPatterns on IngredientApiSearchEntry {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_IngredientApiSearchEntry value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchEntry() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_IngredientApiSearchEntry value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchEntry():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_IngredientApiSearchEntry value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchEntry() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(String value, IngredientApiSearchDetails data)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchEntry() when $default != null:
|
||||
return $default(_that.value, _that.data);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(String value, IngredientApiSearchDetails data) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchEntry():
|
||||
return $default(_that.value, _that.data);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(String value, IngredientApiSearchDetails data)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearchEntry() when $default != null:
|
||||
return $default(_that.value, _that.data);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _IngredientApiSearchEntry implements IngredientApiSearchEntry {
|
||||
@@ -468,6 +779,159 @@ class _$IngredientApiSearchCopyWithImpl<$Res> implements $IngredientApiSearchCop
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [IngredientApiSearch].
|
||||
extension IngredientApiSearchPatterns on IngredientApiSearch {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_IngredientApiSearch value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearch() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_IngredientApiSearch value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearch():
|
||||
return $default(_that);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_IngredientApiSearch value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearch() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(List<IngredientApiSearchEntry> suggestions)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearch() when $default != null:
|
||||
return $default(_that.suggestions);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(List<IngredientApiSearchEntry> suggestions) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearch():
|
||||
return $default(_that.suggestions);
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(List<IngredientApiSearchEntry> suggestions)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _IngredientApiSearch() when $default != null:
|
||||
return $default(_that.suggestions);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _IngredientApiSearch implements IngredientApiSearch {
|
||||
|
||||
@@ -36,7 +36,7 @@ class Log {
|
||||
@JsonKey(required: true, name: 'plan')
|
||||
int planId;
|
||||
|
||||
@JsonKey(required: true)
|
||||
@JsonKey(required: true, toJson: dateToUtcIso8601)
|
||||
late DateTime datetime;
|
||||
|
||||
String? comment;
|
||||
|
||||
@@ -27,7 +27,7 @@ Map<String, dynamic> _$LogToJson(Log instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'meal': instance.mealId,
|
||||
'plan': instance.planId,
|
||||
'datetime': instance.datetime.toIso8601String(),
|
||||
'datetime': dateToUtcIso8601(instance.datetime),
|
||||
'comment': instance.comment,
|
||||
'ingredient': instance.ingredientId,
|
||||
'weight_unit': instance.weightUnitId,
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/helpers/date.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/helpers/misc.dart';
|
||||
import 'package:wger/models/nutrition/log.dart';
|
||||
import 'package:wger/models/nutrition/meal_item.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_values.dart';
|
||||
|
||||
@@ -38,7 +38,7 @@ class NutritionalPlan {
|
||||
@JsonKey(required: true)
|
||||
late String description;
|
||||
|
||||
@JsonKey(required: true, name: 'creation_date', toJson: dateToYYYYMMDD)
|
||||
@JsonKey(required: true, name: 'creation_date', toJson: dateToUtcIso8601)
|
||||
late DateTime creationDate;
|
||||
|
||||
@JsonKey(required: true, name: 'start', toJson: dateToYYYYMMDD)
|
||||
|
||||
@@ -41,7 +41,7 @@ NutritionalPlan _$NutritionalPlanFromJson(Map<String, dynamic> json) {
|
||||
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'description': instance.description,
|
||||
'creation_date': dateToYYYYMMDD(instance.creationDate),
|
||||
'creation_date': dateToUtcIso8601(instance.creationDate),
|
||||
'start': dateToYYYYMMDD(instance.startDate),
|
||||
'end': dateToYYYYMMDD(instance.endDate),
|
||||
'only_logging': instance.onlyLogging,
|
||||
|
||||
@@ -80,7 +80,7 @@ class Log {
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
late WeightUnit? weightUnitObj;
|
||||
|
||||
@JsonKey(required: true, toJson: dateToYYYYMMDD)
|
||||
@JsonKey(required: true, toJson: dateToUtcIso8601)
|
||||
late DateTime date;
|
||||
|
||||
Log({
|
||||
|
||||
@@ -58,5 +58,5 @@ Map<String, dynamic> _$LogToJson(Log instance) => <String, dynamic>{
|
||||
'weight': numToString(instance.weight),
|
||||
'weight_target': numToString(instance.weightTarget),
|
||||
'weight_unit': instance.weightUnitId,
|
||||
'date': dateToYYYYMMDD(instance.date),
|
||||
'date': dateToUtcIso8601(instance.date),
|
||||
};
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:wger/helpers/date.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/helpers/misc.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/day_data.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
@@ -42,7 +42,7 @@ class Routine {
|
||||
@JsonKey(required: true, includeToJson: false)
|
||||
int? id;
|
||||
|
||||
@JsonKey(required: true)
|
||||
@JsonKey(required: true, toJson: dateToUtcIso8601)
|
||||
late DateTime created;
|
||||
|
||||
@JsonKey(required: true, name: 'name')
|
||||
|
||||
@@ -31,7 +31,7 @@ Routine _$RoutineFromJson(Map<String, dynamic> json) {
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$RoutineToJson(Routine instance) => <String, dynamic>{
|
||||
'created': instance.created.toIso8601String(),
|
||||
'created': dateToUtcIso8601(instance.created),
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'fit_in_week': instance.fitInWeek,
|
||||
|
||||
Reference in New Issue
Block a user