import 'package:get/get.dart'; class ChangeUnit extends GetxController { List currentUnits; String selectedUnit; initValue() { currentUnits = []; selectedUnit = ""; update(); } updateListByUnitName(String unitName) { if (unitName == "kg" || unitName == "g") { currentUnits = ["kg", "g"]; selectedUnit = unitName; } else if (unitName == "l" || unitName == "ml") { currentUnits = ["l", "ml"]; selectedUnit = unitName; } else if (unitName == "m" || unitName == "cm" || unitName == "mm") { currentUnits = ["m", "cm", "mm"]; selectedUnit = unitName; } else { currentUnits = []; } update(); } updateSelected(String selected) { selectedUnit = selected; update(); } }