未处理的异常:NoSuchMethodError:类'_InternalLinkedHashMap <String,dynamic>'没有实例方法'cast'具有匹配的参数

时间:2020-08-31 10:58:24

标签: android-studio flutter dart

我对Flutter / Dart还是有点陌生 我从php json文件中恢复了数据,但是在flutter中显示错误。

E/flutter ( 7160): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: 
NoSuchMethodError: Class '_InternalLinkedHashMap<String, dynamic>' has no instance method 'cast' with 
matching arguments.
E/flutter ( 7160): Receiver: _LinkedHashMap len:1
E/flutter ( 7160): Tried calling: cast<Map<String, dynamic>>()
E/flutter ( 7160): Found: cast<RK, RV>() => Map<RK, RV>
E/flutter ( 7160): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)

1 个答案:

答案 0 :(得分:0)

尝试 final items = Map<String, dynamic>.from(json.decode(response.body));