[英]graphql_flutter return LazyCacheMap, built_value deserializeWith JSON String, how to make them work together
graphql_flutter
return LazyCacheMap
, built_value
deserializeWith
JSON String
, how to make them work together. graphql_flutter
回报LazyCacheMap
, built_value
deserializeWith
JSON String
,如何让他们一起工作。
graphql_flutter
to fetch data, and response give the result data as LazyCacheMap
.我使用graphql_flutter
来获取数据,然后响应将结果数据作为LazyCacheMap
。built_value
for data model & data serialization, but since deserializeWith
working with JSON String
.并使用built_value
的数据模型和数据序列化,但由于deserializeWith
有工作JSON String
。What's the best way to work with them together ?与他们一起工作的最佳方式是什么?
LazyCacheMap
's data of to String
and call deserializeWith
?如果我只是转换LazyCacheMap
的的数据String
并调用deserializeWith
?First encode
the response LazyCacheMap
to JSON
using the dart:convert
package, then perform whatever operation you want.首先使用dart:convert
包将响应LazyCacheMap
encode
为JSON
,然后执行您想要的任何操作。
import 'dart:convert';
GraphQLClient _client = graphQLConfiguration.clientToQuery();
QueryResult result = await _client.query(
QueryOptions(
documentNode: gql(GraphQlQueries.authenticateUser()),
)
);
print(jsonEncode(result.data));
Worked for me.为我工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.