提交 2dba367a authored 作者: Todd Volkert's avatar Todd Volkert

Prepare for Uint8List SDK breaking change

A recent change to the Dart SDK updated `HttpClientResponse` to implement `Stream<Uint8List>` rather than implementing `Stream<List<int>>`. This forwards-compatible chnage updates calls to `Stream.transform(StreamTransformer)` to instead call the functionally equivalent `StreamTransformer.bind(Stream)` API, which puts the stream in a covariant position and thus causes the SDK change to be non-breaking. https://github.com/dart-lang/sdk/issues/36900
上级 21ef6cdd
...@@ -42,7 +42,7 @@ class _PayPageState extends State<PayPage> { ...@@ -42,7 +42,7 @@ class _PayPageState extends State<PayPage> {
}; };
var request = await h.getUrl(Uri.parse(_url)); var request = await h.getUrl(Uri.parse(_url));
var response = await request.close(); var response = await request.close();
var data = await response.transform(Utf8Decoder()).join(); var data = await Utf8Decoder().bind(response).join();
Map<String, dynamic> result = json.decode(data); Map<String, dynamic> result = json.decode(data);
print(result['appid']); print(result['appid']);
print(result["timestamp"]); print(result["timestamp"]);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论