Future<void> _capturePng() async {
RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject();
ui.Image image = await boundary.toImage();
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();
setState(() {
data = pngBytes;
});
}
この pngbytes をファイルに変換してデータ形式に渡すにはどうすればよいですか?
FormData formData = new FormData.fromMap({
"image": await MultipartFile.fromFile(image.path,filename: image.path.split("/").last),
"signature": await MultipartFile.fromFile(here),
"latitude": "${_currentPosition.latitude}, ${_currentPosition.longitude}",
});