so i build a alertdialog that contain a field to pick date and his code i put it on Future methode but setState flutter don't recognize it so any suggestions and of course this function outside the main class and when i move it inside the class it won't appear to alertdialog of course
Future<Null> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime(2015, 8),
lastDate: DateTime(2101));
if (picked != null && picked != selectedDate)
setState(() {
selectedDate = picked;
});
}