deleteClothingItem static method

Future<void> deleteClothingItem(
  1. String itemId
)

删除衣物

Implementation

static Future<void> deleteClothingItem(String itemId) async {
  final prefs = await SharedPreferences.getInstance();
  final items = await getAllClothingItems();

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