Here i create a DropdownItemMenu which get the element from firebase collection, but it shows me an error
The method 'showSnackBar' isn't defined for the type 'BuildContext'
Container(
margin: EdgeInsets.only(left: 16, right: 16),
height: MediaQuery.of(context).size.height * 0.10,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: DropdownButton<String>(
isExpanded: false,
style: TextStyle(
fontSize: 14, color: Colors.blueGrey),
icon: const Icon(Icons.keyboard_arrow_down),
underline: Container(color: Colors.transparent),
onChanged: (serieValue) {
final snackBar = SnackBar(
content: Text(
'Série selectionnée est $serieValue',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xff11b719)),
));
Scaffold.of(context.showSnackBar(snackBar));
setState(() {
selectedIndexSerie = serieValue;
});
},
value: selectedIndexSerie,
hint: Text(
'Selectionner une série',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xff11b719)),
),
items: series,
),
),
),
);