Flutter: how to put image(cropped) to next stateful/less widget

Viewed 54

i know there is a lot of q&a s like this with data, but how do i pass image to another screen? i have no idea and i'm stuck for four days please help...

_getFromGallery() async {
XFile? pickedFile = await ImagePicker().pickImage(
  source: ImageSource.gallery,
  maxWidth: 1800,
  maxHeight: 1800,
);
_cropImage(pickedFile!.path);




_cropImage(pickedFile) async {
File? croppedImage = await ImageCropper.cropImage(
  sourcePath: pickedFile,
  maxWidth: 1080,
  maxHeight: 1080,
);
if (croppedImage != null) {
  image = croppedImage;
  setState(() {
  });
}

} }

and i need this cropped image to be at class CreatePage extends StatefulWidget

any help will be so thankful!!

1 Answers

simply pass the image object to next screen and use it in widget

Related