2020-09-30 01:45:57 +00:00
|
|
|
import 'dart:collection';
|
|
|
|
import 'package:buyeeb_mobile/models/yahoo_auctions_item.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
|
|
|
class UserListings extends ChangeNotifier {
|
2020-09-30 03:23:01 +00:00
|
|
|
// final List<YahooAuctionsItem> _items = [];
|
|
|
|
final Map<String, YahooAuctionsItem> _items = {};
|
2020-09-30 01:45:57 +00:00
|
|
|
|
2020-09-30 03:23:01 +00:00
|
|
|
UnmodifiableMapView<String, YahooAuctionsItem> get items => UnmodifiableMapView(_items);
|
2020-09-30 01:45:57 +00:00
|
|
|
|
2020-09-30 03:23:01 +00:00
|
|
|
void add (String key, YahooAuctionsItem item) {
|
|
|
|
_items[key] = item;
|
2020-09-30 01:45:57 +00:00
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
2020-09-30 03:23:01 +00:00
|
|
|
void remove(String key) {
|
|
|
|
_items.remove(key);
|
2020-09-30 01:45:57 +00:00
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeAll() {
|
|
|
|
_items.clear();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|