To have a better view this is the
void _addImage(c) async {
final ImagePicker picker = ImagePicker();
final XFile? image = await picker.pickImage(source: ImageSource.gallery);
print(image?.path);
print(_imagePath?.split('/').last);
if (image != null) {
setState(() {
String _imagePath = attachments.add(image.path);
});
}
}
}
It was invalid, it was to render image uploaded name.
3
Answers
**
This worked out
**
Your code should be like..
You should write it like this:
Couple of things I noticed in this function:
c
parameter is never used_imagePath?.split('/').last
could break depending upon what OS you run it on