Use dynamic instead of type.
e.g.
List<Products> // type
List<dynamic> // dynamic
//to use varialble and not change them
class MyAlert extends StatefulWidget {
final Map task;
const MyAlert({Key? key, required this.task}) : super(key: key);
@override
State<MyAlert> createState() => _MyAlertState();
}
class _MyAlertState extends State<MyAlert> {
TextEditingController titleController = TextEditingController();
@override
Widget build(BuildContext context) {
//if you're not using a state management tool to rebuild a certain part
//the variables below widget build will be reset again
//ex: if used setState()
String dropValue = widget.task['status'];
titleController.text = widget.task['title'];
return AlertDialog(....);
}
}