Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter graphql_flatter返回LazyCacheMap,用JSON字符串反序列化生成值,如何使它们一起工作_Flutter_Graphql - Fatal编程技术网

Flutter graphql_flatter返回LazyCacheMap,用JSON字符串反序列化生成值,如何使它们一起工作

Flutter graphql_flatter返回LazyCacheMap,用JSON字符串反序列化生成值,如何使它们一起工作,flutter,graphql,Flutter,Graphql,graphql\u flatterreturnLazyCacheMap,builded\u值与JSON字符串反序列化,如何使它们协同工作 我使用graphql\u flatter来获取数据,并将结果数据作为LazyCacheMap给出 对于数据模型和数据序列化,使用builded\u值,但由于反序列化使用JSON字符串 与他们合作的最佳方式是什么 我是否应该将的LazyCacheMap的数据转换为String并调用反序列化 我应该使用其他序列化酒吧吗 首先使用dart:convert包将响应L

graphql\u flatter
return
LazyCacheMap
builded\u值
JSON字符串反序列化,如何使它们协同工作

  • 我使用
    graphql\u flatter
    来获取数据,并将结果数据作为
    LazyCacheMap
    给出
  • 对于数据模型和数据序列化,使用
    builded\u值
    ,但由于
    反序列化
    使用
    JSON字符串
  • 与他们合作的最佳方式是什么

    • 我是否应该将的
      LazyCacheMap
      的数据转换为
      String
      并调用
      反序列化
    • 我应该使用其他序列化酒吧吗

    首先使用
    dart:convert
    包将响应
    LazyCacheMap
    编码为
    JSON
    ,然后执行您想要的任何操作

    import 'dart:convert';
    
    GraphQLClient _client = graphQLConfiguration.clientToQuery();
    QueryResult result = await _client.query(
      QueryOptions(
        documentNode: gql(GraphQlQueries.authenticateUser()),
      )
    );
    
    print(jsonEncode(result.data));
    

    为我工作。

    你是如何解决这个问题的?@GEPD,使用LazyCacheMap.data谢谢!你应该把答案写在新的帖子里