Use the bodyBytes field on the Response object to get the response in bytes.
import 'package:http/http.dart' as http; import 'package:crypto/crypto.dart'; main() async { var url = "https://www.dartlang.org/logos/dart-logo.png"; var response = await http.get(url); List<int> bytes = response.bodyBytes; // Do something with the bytes. For example, convert to base64. String base64 = CryptoUtils.bytesToBase64(bytes); print(base64); }
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did129496