0

Flutter Dropdownbutton selected value is not changing I am using dropdownbutton and mapping data using Product model but onchange my value is not changing

DropdownButtonHideUnderline(
                        child: DropdownButton<Product>(
                          hint: Text("Select Product"),
                          dropdownColor: Colors.white,
                          isExpanded: true,
                          items: _productController.products
                              .map((Product value) {
                            return new DropdownMenuItem<Product>(
                              value: value,
                              child: new Text(value.productName),
                            );
                          }).toList(),
                          onChanged: (Product val) {
                            _stockController.price.text = val.price;
                            _stockController.productName.text = val.productName;
                            selectedProduct = val.productName;
                            TextStyle(color: Colors.black);
                            setState(() {});
                          },
                        ),
                      ),
Basit Amin
  • 35
  • 3

1 Answers1

0

You didn't specify the value property of this widget. I think it should be set to value of selectedProduct. And what the separate TextStyle? It is used as value for style property of widgets and cannot be used as standalone.

BambinoUA
  • 6,126
  • 5
  • 35
  • 51