mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Add new elements to beginning of list
This commit is contained in:
@@ -62,7 +62,7 @@ class NutritionalPlans with ChangeNotifier {
|
||||
);
|
||||
print(plan.toJson());
|
||||
print(json.decode(response.body));
|
||||
_entries.add(NutritionalPlan.fromJson(json.decode(response.body)));
|
||||
_entries.insert(0, NutritionalPlan.fromJson(json.decode(response.body)));
|
||||
notifyListeners();
|
||||
} catch (error) {
|
||||
print(error);
|
||||
|
||||
@@ -150,13 +150,9 @@ class WorkoutPlans with ChangeNotifier {
|
||||
},
|
||||
body: json.encode(workout.toJson()),
|
||||
);
|
||||
print(workout.toJson());
|
||||
print(json.decode(response.body));
|
||||
final newWorkout = WorkoutPlan.fromJson(json.decode(response.body));
|
||||
_entries.add(newWorkout);
|
||||
_entries.insert(0, WorkoutPlan.fromJson(json.decode(response.body)));
|
||||
notifyListeners();
|
||||
} catch (error) {
|
||||
print(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user