title: How to refresh state of image path in flutter?
body: <p>Hello I have found how to display a taken picture from camera, but first to display I need to reload the app and same for remove picture. Changed are visible only if I reload the app and not directly after action ( onPressed button ).</p>
  
  <p>Here is my code:</p>
  
  <pre class="lang-dart prettyprint-override"><code>Future&lt;String&gt; picture() async {
  final Directory extDir = await getApplicationDocumentsDirectory();
      setState(() {
          if ( imagePath!= null){
          imagePath="${extDir.path}/Pictures/$daysfromnow_modify.jpg";
          }
      });
  }
  </code></pre>
  
  <p>To display image from path I use: <code>Image.file(new File(imagePath),),</code>.</p>
  
  <p>Here is the part where I increase or decrease <code>$daysfromnow_modify</code>.</p>
  
  <pre class="lang-dart prettyprint-override"><code>new IconButton(
      icon: Icon(Icons.keyboard_arrow_left),
      iconSize: 30.0,
      color: Colors.black,
      onPressed: () {
          setState(() {
              changedate--;
  
              DateTime now = DateTime.now();
              final _dateFormatter = DateFormat.yMMMMd("fr_FR");
              DateTime daysfromnow = now.add(new Duration(days: changedate));
  
              formattedDate = _dateFormatter.format(daysfromnow);
  
  
              RegExp regExp = new RegExp(r"(^\S*)"); // Here is the regex fonction to extract long, lat
              var match = regExp.firstMatch("$daysfromnow");
              daysfromnow_modify = match.group(1);
          });
      }
  )
  </code></pre>
  
  <p>I call <code>picture()</code> at the init, when I increase or decrease <code>$daysfromnow_modify</code> to switch next or previous photo and I call him also when I remove the path. For all this call I expect a refresh of stats but nothing.</p>