未处理的异常:NoSuchMethodError:类'_InternalLinkedHashMap <String,dynamic>'没有实例。用matchin方法“ cast”

时间:2020-06-22 19:04:04

标签: flutter dart

我的错误是未处理的异常:NoSuchMethodError:类'_InternalLinkedHashMap '没有具有匹配参数的实例方法'cast'。

      static Future<List<RetriveQueueListResponse>> GetQueueList() async {
        var response = await http.get('https://queue-keeper.herokuapp.com/api/v1/queue/2');
        if (response != null) {
          List<RetriveQueueListResponse> list = parseBookedQueueList(response.body);
          List users = json.decode(response.toString()) as List;
          return users.map((user) => RetriveQueueListResponse.fromJson(user)).toList();
        } else {
          throw Exception('Failed to load data!');
        }
      }

0 个答案:

没有答案