mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-03 10:33:54 +01:00
Changed MeasurementEntry's value string to number
Reflects the changes made to the rest api. MeasurementEntry's value is a number instead of a string when in json format
This commit is contained in:
@@ -15,7 +15,7 @@ class MeasurementEntry extends Equatable {
|
||||
@JsonKey(required: true, toJson: toDate)
|
||||
final DateTime date;
|
||||
|
||||
@JsonKey(required: true, fromJson: stringToNum, toJson: numToString)
|
||||
@JsonKey(required: true)
|
||||
final num value;
|
||||
|
||||
@JsonKey(required: true, defaultValue: '')
|
||||
|
||||
@@ -13,7 +13,7 @@ MeasurementEntry _$MeasurementEntryFromJson(Map<String, dynamic> json) {
|
||||
id: json['id'] as int?,
|
||||
category: json['category'] as int,
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
value: stringToNum(json['value'] as String?),
|
||||
value: json['value'] as num,
|
||||
notes: json['notes'] as String? ?? '',
|
||||
);
|
||||
}
|
||||
@@ -23,6 +23,6 @@ Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) =>
|
||||
'id': instance.id,
|
||||
'category': instance.category,
|
||||
'date': toDate(instance.date),
|
||||
'value': numToString(instance.value),
|
||||
'value': instance.value,
|
||||
'notes': instance.notes,
|
||||
};
|
||||
|
||||
@@ -85,6 +85,7 @@ class MeasurementProvider with ChangeNotifier {
|
||||
_categories.removeAt(categoryIndex);
|
||||
_categories.insert(categoryIndex, editedCategory);
|
||||
notifyListeners();
|
||||
print(_categories);
|
||||
}
|
||||
|
||||
/// Adds a measurement category
|
||||
|
||||
Reference in New Issue
Block a user