Reputation: 2411
I have code like this and I want to know what type of file I get. png or jpg. How to do this?
var image;
File _image;
image = await ImagePicker.pickImage(source: source);
setState(() {
_image = image;
});
Upvotes: 0
Views: 749
Reputation: 573
I only thought of this solution, intercepting the path string.
List<String> imagePathArr = _image.path.split(".");
print("image's type = ${imagePathArr[1]}");
Upvotes: 1