addClothingItems static method

Future<void> addClothingItems(
  1. List<ClothingItem> newItems
)

批量添加衣物

Implementation

static Future<void> addClothingItems(List<ClothingItem> newItems) async {
  final prefs = await SharedPreferences.getInstance();
  final items = await getAllClothingItems();
  items.addAll(newItems);

  final jsonList = items.map((item) => item.toJson()).toList();
  await prefs.setString(_keyClothingItems, jsonEncode(jsonList));
}