title: Flutter - Save network image to sqflite
body: <p>Hello guys i want to safe an image in my <a href="https://pub.dev/packages/sqflite" rel="nofollow noreferrer">sqflite</a> database i tried many thing but i only get errors like invalid image data or something else.</p>
  <pre><code>class HomeScreen extends StatelessWidget {
  
  String _base64 =&quot;&quot;;
  
  @override
  Widget build(BuildContext context) {
  
  () async {
    http.Response response = await http.get(Uri.parse(
        &quot;https://www.mera-petfood.com/files/_processed_/a/4/csm_iStock-521697453_69acb65057.jpg&quot;));
  
    _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(&quot;open database&quot;),
            onPressed: () async {},
          ),
  
          Image.memory(bytes),
          Text(model.base64String(bytes)),
        ],
      ),
    ),
  );
  }
  }
  </code></pre>
  <p>thats my actual code but i only get this Exception:</p>
  <pre><code>════════ Exception caught by image resource service ════════════════════════════
  The following _Exception was thrown resolving an image codec:
  Exception: Invalid image data
  </code></pre>
  <p>Why is it not working i cant solve it?</p>