【发布时间】:2019-04-24 06:46:40
【问题描述】:
我的应用在针对 Android 模拟器进行调试时可以成功验证,但如果我尝试使用针对物理设备(具有相同操作系统版本)的调试进行验证,则在等待超过一分钟后会出现错误消息:
发生异常。
_TypeError(类型'String'不是'index'类型'int'的子类型)
错误信息指向如下代码:
if (responseJson[AuthUtils.authTokenKey] != null) {
AuthUtils.insertDetails(
userNameController.text, passwordController.text, responseJson);
...
} else {
...
};
在调试控制台中,我得到以下信息:
I/flutter (9531): Auth: SocketException: OS Error: Connection timed 出,errno = 110,地址 = example.com,端口 = 38975 V/InputMethodManager(9531):开始输入: tba=android.view.inputmethod.EditorInfo@4aece4e nm : example.com.todoapp ic=null
我在这里做错了什么?
【问题讨论】:
-
responseJson似乎被推断为List类型,并且在索引访问器responseJson[intIndexhere]中需要一个整数,但AuthUtils.authTokenKey是String,此处不支持。仅当responseJson是Map时才支持此方法