Use the headers field of the Response object to get a headers Map. The map keys are the header fields, and the map values are the values those fields.
import 'package:http/http.dart' as http; main() async { var url = 'http://httpbin.org/'; var response = await http.get(url); // Get the headers map. print(response.headers.keys); // Get header values. print( "access-control-allow-origin' = ${response.headers['access-control-allow-origin']}"); print("content-type = ${response.headers['content-type']}"); print("date = ${response.headers['date']}"); print("content-length = ${response.headers['content-length']}"); print("connection = ${response.headers['connection']}"); }
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did129474