Flutter Compress Camera Image

Solution for Flutter Compress Camera Image
is Given Below:

I want to click the photo through camera and want to compress it and then upload it to the server

i have included the Image Compress Dependency its Showing me the error The getter ‘absolute’ isn’t defined for the type ‘PickedFile’.

written the code of Clicking photo and uploading it to server
// Taking Photo From Camera

Widget bottomSheet() {
return Container(
  height: 100.0,
  width: MediaQuery.of(context).size.width,
  margin: EdgeInsets.symmetric(
    horizontal: 20,
    vertical: 20,
  ),
  child: Column(
    children: <Widget>[
      Text(
        "Take A Picture",
        style: TextStyle(
          fontSize: 20.0,
        ),
      ),
      SizedBox(
        height: 20,
      ),
      Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
        // ignore: deprecated_member_use
        FlatButton.icon(
          icon: Icon(Icons.camera),
          onPressed: () {
            takePhoto(ImageSource.camera);
          },
          label: Text("Camera"),
        ),
      ])
    ],
  ),
);
}

void takePhoto(source) async {
final pickedFile = await _picker.getImage(
  source: source,
);
setState(() {
  _imageFile = pickedFile;
});
await FlutterImageCompress.compressWithFile(
  _imageFile.absolute.path,
  minWidth: 2300,
  minHeight: 1500,
  quality: 94,
  rotate: 90,
);
 }

Instead of using FlutterImageCompress.compressWithFile just add imageQuality in the _picker.getImage

_picker.getImage(
      source:ImageSource.camera,
      minWidth: 2300,
      minHeight: 1500,
      imageQuality: 75
)

As with the image quality value size of the image get changed