PMU_BTSYLEV_V.A_PIbd-32/lib/VideoCardsManager.dart

23 lines
624 B
Dart
Raw Normal View History

2024-11-13 04:43:37 +04:00
import 'VideoCards.dart';
class VideoCardsManager {
final List<VideoCards> _videocards = [];
void addVideoCards(VideoCards videocards) {
_videocards.add(videocards);
}
List<VideoCards> filterVideoCardsByCategory(VideoCardsCategory category) {
return _videocards.where((videocards) => videocards.category == category).toList();
}
double calculateTotalAmount() {
return _videocards.fold(0.0, (sum,videocards) => sum + videocards.price);
}
Future<void> clearVideoCards() async {
await Future.delayed(Duration(seconds: 3));
_videocards.clear();
print('Список чист!');
}
}