getx dropdown
class BookController extends GetxController {
// It is mandatory initialize with one value from listType
final selected = "some book type".obs
void setSelected(String value){
selected.value = value;
}
}
getx dropdown
class BookController extends GetxController {
// It is mandatory initialize with one value from listType
final selected = "some book type".obs
void setSelected(String value){
selected.value = value;
}
}
getx dropdown
BookController bookcontroller = BookController();
Obx( () => DropdownButton(
hint: Text(
'Book Type',
),
onChanged: (newValue) {
bookController.setSelected(newValue);
},
value: bookController.selected.value,
items: bookController.listType.map((selectedType) {
return DropdownMenuItem(
child: new Text(
selectedType,
),
value: selectedType,
);
}).toList(),
)
),
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us