title: Flutter - SQFlite store and load image from database
body: <p>I want to save an image inside the sqflite database and the later on, I want to display it in a SliverAppBar as a background. Till now I am able to save the image(not sure if it is right, but throws no error XD):</p>
  
  <pre><code>Directory directory = await getApplicationDocumentsDirectory();
  String path = directory.path;
  File newImage = await _image.copy('$path/${recipeName.text}.png'); //_image already taken with image_picker plugin
  String base64Encoded = base64Encode(newImage.readAsBytesSync());
  </code></pre>
  
  <p>And this String I am saving inside the database. But I also want to display. And as far I know, I have to get the String, but from now I on, I do not know anything how to get further. I have written a function to get the String, but do not know what I should do with this String. The function looks like this:</p>
  
  <pre><code>Future fetchRecipe(String name) async{
    var dbHelper = new DBHelper();
    Future&lt;List&lt;Recipes&gt;&gt; recipes = dbHelper.getSpecRecipe(name);
    return recipes;
  }
  </code></pre>
  
  <p>The <code>getSpecRecipe(name)</code> points to this function: </p>
  
  <pre><code>Future&lt;List&lt;Recipes&gt;&gt; getSpecRecipe(String recipeName) async{
      List&lt;Map&gt; list = await _db.rawQuery("SELECT * FROM recipes WHERE name = ?", [recipeName]);
      List&lt;Recipes&gt; recipes = new List();
      for(int i =0; i &lt; list.length; i++){
        recipes.add(new Recipes(list[i]["id"], list[i]["name"], list[i]["definition"], list[i]["duration"], list[i]["favorite"], list[i]["timestamp"], list[i]["image"], list[i]["backgroundColor"]));      
      }   
      return recipes;
    }
  </code></pre>
  
  <p>It would be awesome, if somebody would be able to solve my problem. Thanks in advanceXD</p>