IOClient在Dart http包中放在哪里? [英] Where did IOClient go in the Dart http package?
问题描述
我正在处理Flutter项目中的http请求。我已经看到几个有关 IOClient
的答案。例如,此处和此处和此处。但是,以下导入无效(尽管它们显然曾经使用过):
I'm working on making http requests from a Flutter project. I have seen several answers refer to IOClient
. For example, here and here and here. However, the following imports do not work (though they apparently used to):
import 'package:http/http.dart';
import 'package:http/http.dart' show IOClient;
相反,第二个给出错误消息:
Instead, the second one gives the error message:
库 package:http / http.dart不会导出名称为 IOClient的成员。
The library 'package:http/http.dart' doesn't export a member with the shown name 'IOClient'.
如何导入IOClient?
How do I import IOClient?
推荐答案
IOClient
仍在 http
包,但它不再位于 http
库。它已作为 io_client
。您可以这样导入它:
IOClient
is still in the http
package but it is no longer in the http
library. It has been extracted into its own library as io_client
. You can import it like this:
import 'package:http/io_client.dart';
这篇关于IOClient在Dart http包中放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!