Flutter 删除颤振中的.bg api http返回后映像
[错误:flatter/lib/ui/ui\u dart\u state.cc(177)]未处理的异常:FormatException:无效 性格 (第1部分) E/颤振(27845):‰巴布亚新几内亚 E/颤振(27845):^Flutter 删除颤振中的.bg api http返回后映像,flutter,http,Flutter,Http,[错误:flatter/lib/ui/ui\u dart\u state.cc(177)]未处理的异常:FormatException:无效 性格 (第1部分) E/颤振(27845):‰巴布亚新几内亚 E/颤振(27845):^ plllzzzzz neeeed help这就是显示的内容[ERROR:flatter/lib/ui/ui_dart_state.cc(177)]未处理的异常:FormatException:Invalid character(在字符1处)E/flatter(278
plllzzzzz neeeed help这就是显示的内容[ERROR:flatter/lib/ui/ui_dart_state.cc(177)]未处理的异常:FormatException:Invalid character(在字符1处)E/flatter(27845):PNG E/flatter(27845):^[ERROR:flatter/lib/ui/ui_dart_state.cc(177)]未处理的异常:FormatException:Invalid character(在字符1处)E/flatter(27845):PNG E/flatter(27845):^[错误:flatter/lib/ui/ui\u dart\u state.cc(177)]未处理的异常:FormatException:无效字符(位于字符1处)E/flatter(27845):PNG E/flatter(27845):^
_asyncMethod() async {
ByteData bytes = await rootBundle.load('assets/images/technology.jpg');
var buffer = bytes.buffer;
var m = base64.encode(Uint8List.view(buffer));
final body = {"image_file_b64": m, "size": "auto"};
final headers = {"X-API-Key": "xxxxxxxxxxxxxxxxxxxx"};
final response = await http.post('https://api.remove.bg/v1.0/removebg',
body: body, headers: headers);
if (response.statusCode == 200) {
responseBody = response.body;
var jsonResponse = convert.jsonDecode(response.body);
debugPrint("$jsonResponse");
//var itemCount = jsonResponse['data'];
// ignore: unnecessary_statements
} else {
throw Exception(
'Failed to do network requests: Error Code: ${response.statusCode}\nBody: ${response.body}');
}