停止在文本小部件的循环中更改字符串中的数字

问题描述

这里我从 API 中获取字符串值。该字符串是使用 Provider 类收集的,而 Access 是使用消费者收集的。它正确地穿了绳子。但是那个字符串的数字一直在变化,我忍不住在这里附上了这个问题的视频。

文本小部件:

Text(
              mcq.selectedMCQ.questionTitle,style: TextStyle(fontSize: 20),),

供应商:

未来 getFetchQuestion(String questionId) async{

var url = Uri.parse('${BaseUrl.url}/MobileAPI/getQuestionByID/$questionId');
var response = await http.get(
  url,headers: {
    "Content-Type": "application/json",},);

if (response.statusCode == 200) {
  final responseData = json.decode(response.body);

  MCQ result =
  MCQ.fromJson(responseData);
  _selectedMCQ = result;
  notifyListeners();
}

}

MCQ 类:

  late String mcqQuestionId;
  late String moduleId;
  late String mcqId;
  late String type;
  late String step;
  late int questionNumber;
  late String questionTitle;
  late String status;
  late List<MCQAnswer> mcqAnswerList;

  MCQ({
    required this.mcqQuestionId,required this.moduleId,required this.mcqId,required this.type,required this.step,required this.questionNumber,required this.questionTitle,required this.status,required this.mcqAnswerList,});

  factory MCQ.fromJson(dynamic json) {
    var mcqAnswerList = json[0]['QuestionList'] as List;
    List<MCQAnswer> loadedAnswerList =
        mcqAnswerList.map((e) => MCQAnswer.fromJson(e)).toList();
    return MCQ(
      mcqQuestionId: json[0]['_id'].toString(),moduleId: json[0]['moduleID'],mcqId: json[0]['mcqID'],type: json[0]['type'],step: json[0]['step'],questionNumber: json[0]['no'],questionTitle: json[0]['questionTitle'],status: json[0]['status'],mcqAnswerList: loadedAnswerList,);
  }
}

Video of the issue.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...