title: how to convert image to byte and again convert it to image in flutter?
body: <p>I am trying to use the <strong>image_picker</strong> plugin. I can get the image as file using this plugin. I need to convert this image to bytes and send to a api. So I tried to use dart:convert to convert the  image to byte string. Now when I decode I am getting a <strong>Uint8List</strong> type. How to convert this to a file and display in a <strong>Image.file()</strong>. I couldn’t proceed from here. Can someone help me with this.</p>
  
  <p>consider i am getting this decodedBytes i am getting from a api response, how can i convert them to display in a Image widget </p>
  
  <p>This is the code I tried so far.</p>
  
  <pre><code>var image = await ImagePicker.pickImage(source: ImageSource.camera);
  
      setState(() {
        imageURI = image;
        final bytes = image.readAsBytesSync();
  
        String img64 = base64Encode(bytes);
        print(bytes);
        print(img64);
  
        final decodedBytes = base64Decode(img64);
        print(decodedBytes);
        //consider i am getting this decodedBytes i am getting from a api response, how can i convert them to display in a Image widget 
      });
  </code></pre>
  
  <p>I am getting this error using <strong>writeAsBytesSync()</strong>, </p>
  
  <pre><code>Unhandled Exception: FileSystemException: Cannot open file, path = 'decodedimg.png'
  </code></pre>