Finally, I found the solution, I don't know if it is important and will be useful to anyone who is struggling like me, but I am going to help. So, it would be easy and quick because I have already converted my image to nedeed formart (my image is base64 format), i made a dumb mistake when I was trying to convert it in String again, because it is already a String and I need Uint8List format. Side note: if your api devs said it should take a cookie or any kind of auth, it should be so.
code:
Future<String> _createFileFromString() async {
final response = await http.get(
Uri.parse(
'your link here',
),
headers: {
'cookie':
'your cookie here'
});
final Uint8List bytes = response.bodyBytes;
String dir = (await getApplicationDocumentsDirectory()).path;
String fullPath = '$dir/abc.png';
print("local file full path ${fullPath}");
File file = File(fullPath);
await file.writeAsBytes(List.from(bytes));
print(file.path);
final result = await ImageGallerySaver.saveImage(bytes);
print(result);
return file.path;
}
This code saves your image in straight to the app gallery and do not display on the screen anything