I get the error below while running the Flutter app on the Chrome web browser. I picked an Image from the gallery:
Future getImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
if (image == null) {
return;
}
final imageTemp = XFile(image.path);
setState(() => this._userImage = imageTemp);
} on PlatformException catch (e) {
e.stacktrace;
}
}
Code:
dynamic getUserImage() {
if (_userImage?.path == null) {
return const Icon(
Icons.person,
color: Colors.grey,
size: 54,
);
} else {
return Image.file(File(_userImage!.path));
}
}
Image:
What should I use or change to pick an image from the Web gallery or Camera?