I am getting the image by image picker and then adding the file to the list of file but it shows the error-The method 'add' was called on null.. My code:-
final picker=ImagePicker();
selectImageFromGallery() async
{
setState(() {
inProcess=true;
});
final imageFile= await picker.getImage(source: ImageSource.gallery);
if(imageFile!=null)
{
File _image=File(imageFile.path);
files.add(_image);
}
setState(() {
inProcess=false;
});
}