i have an array in my Provider class like this
List<String> _modelImages = [];
List<String> get modelImages {
return [..._modelImages];
}
and i have a function that add data to array
void addModel(dynamic modelSelected) async {
try {
var isExist = _modelImages.contains(modelSelected["id"]);
if (!isExist) {
_modelImages.add(modelSelected["id"]);
print(_modelImages);
}
notifyListeners();
} catch (error) {
print(error);
}
}
when i print array in up function show me that String added to array but i have other funciton like below
void showMe() {
print(_modelImages);
}
my problem is when i want to print _modelImages array in ShowMe function show me empty array
what is the problem?