getNotes method
return notes list to UI
Implementation
bool getNotes() {
Utils.showToast("Refreshing...");
Api.getNotes().then((list) {
if (list != null && list.isNotEmpty) {
notesList = list;
errorMsg = null;
} else {
errorMsg = "No data found!";
}
notifyListeners();
}).catchError((error) {
errorMsg = Utils.getErrorMessage(error);
Utils.showToast(Utils.getErrorMessage(error));
notifyListeners();
});
}