Hello guys i want to safe an image in my sqflite database i tried many thing but i only get errors like invalid image data or something else.
class HomeScreen extends StatelessWidget {
String _base64 ="";
@override
Widget build(BuildContext context) {
() async {
http.Response response = await http.get(Uri.parse(
"https://www.mera-petfood.com/files/_processed_/a/4/csm_iStock-521697453_69acb65057.jpg"));
_base64 = base64Encode(response.bodyBytes);
};
Uint8List bytes = base64Decode(_base64);
return Scaffold(
appBar: null,
body: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
child: const Text("open database"),
onPressed: () async {},
),
Image.memory(bytes),
Text(model.base64String(bytes)),
],
),
),
);
}
}
thats my actual code but i only get this Exception:
════════ Exception caught by image resource service ════════════════════════════
The following _Exception was thrown resolving an image codec:
Exception: Invalid image data
Why is it not working i cant solve it?