错误:未为类“ dart.core :: int”定义方法“ []”

时间:2018-12-09 09:16:45

标签: dart flutter

运行Flutter项目时出现错误,我需要帮助。我克隆了

https://github.com/miketraverso/devfestapp

所有软件包更新后-我收到以下错误:编译器消息:

lib/views/scheduled_session_widget.dart:51:34: Error: The method '[]' isn't defined for the class 'dart.core::int'.
Try correcting the name to the name of an existing method, or defining a method named '[]'.
mSessions[sessionIter['0'].toString()]; // ignore: undefined_operator

有人可以解释我该怎么做才能解决此错误吗?

1 个答案:

答案 0 :(得分:0)

会话似乎是int的集合:TimeSlot类中的Firebase#deleteInstanceId(),后来您有了forEach,因此可以将代码替换为:

List<int> sessions;