updateClothingItem static method
更新衣物
Implementation
static Future<void> updateClothingItem(ClothingItem item) async {
final prefs = await SharedPreferences.getInstance();
final items = await getAllClothingItems();
final index = items.indexWhere((i) => i.id == item.id);
if (index != -1) {
items[index] = item;
final jsonList = items.map((item) => item.toJson()).toList();
await prefs.setString(_keyClothingItems, jsonEncode(jsonList));
}
}