Skip to content

Commit

Permalink
refactor: restaurant cart getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizz-33 committed Mar 25, 2024
1 parent f3900cb commit 0073b69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/models/restaurant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class Restaurant extends ChangeNotifier{
];

List<Food> get menu => _menu;
List<CartItem> get cart => _cart;

//cart
final List<CartItem> _cart = [];
Expand Down
8 changes: 8 additions & 0 deletions lib/pages/cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ class CartPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<Restaurant> (builder: (context, restaurant, child) {
//cart
final userCart = restaurant.cart;

//screen
return Scaffold(
appBar: AppBar(
title: Text('data'),
),
);
});
}
}

0 comments on commit 0073b69

Please sign in to comment.