未处理的异常:类型'_InternalLinkedHashMap <String,dynamic>'不是类型转换中'List <dynamic>'类型的子类型

这是API返回的json。

{
    id: 1,
    name: Nhel Theavuth,
    email: info@theavuth.me,
    username: theavuth,
    avatar: null,
    phone_number: null,
    token: 
}

颤振错误。

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>' in type cast

任何人都可以帮忙吗? 提前致谢

评论
  • ket
    ket 回复

    I need to more information about what is happening, assingin code. But it seems like you need to call .toList() in order to get a List from your JSON result, because Dart manage json as Map.