- I'm trying to add the switch case statement in IconData and Icon Color when i use they throw some errors
- The non-nullable local variable 'iconData' must be assigned before it can be used. Try giving it an initializer expression, or ensure that it's assigned on every execution path
TodoAddPage.dart
class TodoCardPage extends StatefulWidget { const TodoCardPage({ Key? key, required this.title, required this.iconData, required this.iconColor, }) : super(key: key); final String title; final IconData iconData; final Color iconColor;
In home page I try to use homePage.dart
ListView.builder(
itemCount: (snapshot.data! as QuerySnapshot).docs.length,
itemBuilder: (context, index) {
IconData iconData;
Color iconColor;
Map<String, dynamic> document =
(snapshot.data! as QuerySnapshot).docs[index].data()
as Map<String, dynamic>;
return TodoCardPage(
title: document["title"] == null
? "Hey There"
: document["title"],
iconData: iconData,
iconColor: iconColor,
time: "10 PM",
value: true,
iconBgColor: Colors.white);
});