title: Image is not getting Updated even after using setState In Flutter
body: <p>I'm Using ImagePicker and ImageCropper Package to pick and crop an image from the gallery or by capturing using a camera. Everything is working fine but the Picked image is not updating on UI even after using the SetState method. When I press the button for image Selection Again Previously selected Image Appears on the UI. I have no Idea what Is causing this delay.</p>
  <p>My ImageProcessing Class Code</p>
  <pre><code>class ImageProcess{
    File _image, croppedFile;
    final picker = ImagePicker();
    //Getting Image From Gallery Or Camera.
    File getImage(BuildContext context) {
      showDialog(
          context: context,
          builder: (context) {
            return AlertDialog(
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(15))),
              content: Container(
                  height: 250,
                  width: 250,
                  child: Row(
                    children: [
                      IconButton(
                          iconSize: 100,
                          icon: Icon(Icons.insert_photo),
                          onPressed: () async {
                            final pickedFile = await picker.getImage(
                                source: ImageSource.gallery,imageQuality: 20);
                            _image = File(pickedFile.path);
                          croppedFile = await _cropImage();
                            Navigator.of(context).pop(true);
                          }),
                      IconButton(
                          iconSize: 100,
                          icon: Icon(Icons.camera),
                          onPressed: () async {
                            final pickedFile =
                            await picker.getImage(source: ImageSource.camera,imageQuality: 20);
                            _image = File(pickedFile.path);
                         croppedFile =  await _cropImage();
                            Navigator.of(context).pop(true);
                          })
                    ],
                  )),
            );
          });
      return croppedFile;
    }
  
    //Cropping image which has been retrieved from gallery or gallery.
    Future&lt;File&gt; _cropImage() async {
     return await ImageCropper.cropImage(
          sourcePath: _image.path,
          aspectRatioPresets: Platform.isAndroid
              ? [
            CropAspectRatioPreset.square,
          ]
              : [
            CropAspectRatioPreset.square,
          ],
          androidUiSettings: AndroidUiSettings(
              toolbarTitle: 'Product Image Cropper',
              toolbarColor: kDarkYellow,
              toolbarWidgetColor: Colors.white,
              initAspectRatio: CropAspectRatioPreset.square,
              lockAspectRatio: false),
          iosUiSettings: IOSUiSettings(
            title: 'Product Image Cropper',
          ));
    }
  }
  </code></pre>
  <p>Ui code</p>
  <pre><code>class AddItem extends StatefulWidget {
    @override
    _AddItemState createState() =&gt; _AddItemState();
  }
  
  class _AddItemState extends State&lt;AddItem&gt; {
    File croppedFile;
    ImageProcess im = new ImageProcess();
    @override
    Widget build(BuildContext context) {
      return SafeArea(
        child: Scaffold(
            backgroundColor: kVeryDarkBlue,
            body: SingleChildScrollView(
                child: Padding(
                  padding: EdgeInsets.fromLTRB(20, 20, 20, 0),
                  child: Column(
                    children: [
                      Container(
                          height: MediaQuery.of(context).size.height * 0.15,
                          width: MediaQuery.of(context).size.height * 0.15,
                          child: croppedFile == null
                              ? ClipOval(
                              child:
                              Image.asset('assets/images/image.png'))
                              : ClipOval(child: Image.file(croppedFile))),
                      RaisedButton(onPressed: () {
                          croppedFile= im.getImage(context);
                          setState(() {
                          });
                      },child: Text('Press'),)
                    ],
                  ),
                ))),
      );
    }
  }
  </code></pre>
  <p>I have tried every possible solution which came Into My mind.</p>