I have a Question class.
class Question {
String questionCatNum;
int questionNumber;
Question({
required this.questionCatNum,
required this.questionNumber,
});
factory Question.fromFirestore(
DocumentSnapshot<Map<String, dynamic>> snapshot) {
Map data = snapshot.data()!;
return Question(
questionCatNum: data['questionCatNum'],
questionNumber: data['questionNumber'],
);
}
}
How can I initialize it using Getx. I tried below but it is error.
RxList<Question> questionsList = [].obs;
CodePudding user response:
Use this
RxList<Question> questionsList = RxList<Question>([]);
CodePudding user response:
Use it as
RxList<Question> questionsList = <Question>[].obs;