flutter - graphql_flutter return LazyCacheMap,built_value deserializeWith JSON String,如何让它们协同工作
问题描述
graphql_flutter
return LazyCacheMap
, built_value
deserializeWith
JSON String
, 如何让它们一起工作。
- 我
graphql_flutter
用来获取数据,响应将结果数据作为LazyCacheMap
. - 并
built_value
用于数据模型和数据序列化,但由于deserializeWith
使用JSON String
.
与他们一起工作的最佳方式是什么?
- 我应该只转换
LazyCacheMap
to 的数据String
并调用deserializeWith
吗? - 我应该使用其他序列化 pubs 吗?
解决方案
首先是对使用包encode
的响应,然后执行您想要的任何操作。LazyCacheMap
JSON
dart:convert
import 'dart:convert';
GraphQLClient _client = graphQLConfiguration.clientToQuery();
QueryResult result = await _client.query(
QueryOptions(
documentNode: gql(GraphQlQueries.authenticateUser()),
)
);
print(jsonEncode(result.data));
为我工作。
推荐阅读
- javascript - 如何将异步添加到谷歌云功能?
- ios - 在 collectionview 中以不同大小的网格格式显示图像
- c# - 使用 ArgumentValidator.VerifyNotNullOrEmpty 进行单元测试
- php - 使用 codeigniter 和 filepond 在数据库中插入多个图像
- python - 如何抓取维基百科信息框并将其存储到 csv 文件中
- powershell - 在 Powershell (Win 10) 中执行批处理不影响父 Shell
- ajax - 在laravel中单击按钮时如何增加DB中的计数值?
- python - 编辑不在 for 循环中工作的数组
- c - 如何处理返回值 inf
- python - 如何在 Tensorflow 中恢复两个图?