Flutter中如何返回Future<Response>?

5 dart flutter

我正在 Flutter 上编写一个函数,它从 API 获取数据。函数完成后,我需要返回变量Future<Response>

这是函数:

final String apiUrl =  "http://api.aladhan.com/v1/calendarByCity?city=Kayseri&country=Turkey&method=13&month=07&year=2021";

Future<Response> fetchData() async {
 var result = await http.get(Uri.parse(apiUrl));
 return result;
}
Run Code Online (Sandbox Code Playgroud)

但是,我从编译器收到此消息:

The name 'Response' isn't a type so it can't be used as a type argument.
Try correcting the name to an existing type, or defining a type named 'Response'
Run Code Online (Sandbox Code Playgroud)

还有其他方法可以返回该变量吗?

谢谢

Hut*_*yad 2

Future<http.Response> 
Run Code Online (Sandbox Code Playgroud)

使用http,因为这就是您导入它的方式。