import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_fetchnotes_k2.dart'; import 'package:discover_module/contacts_module/service.dart/k2_service/Apicall_k2.dart'; import 'package:flutter/material.dart'; class HcpNotesFecth extends ChangeNotifier { var call_api = CallK2api(); List listnotes = []; List get ListNotes => listnotes; bool _isLoading = false; bool _hasMore = true; int _page = 1; final int _limit = 10; bool get isLoading => _isLoading; bool get hasMore => _hasMore; // fetchhcpnotes() async { // final listallnotes = await call_api.getallnotes(); // print("Hiiiiiilistallnotes : ${listallnotes}"); // listnotes = listallnotes!; // notifyListeners(); // } fetchhcpnotes() async { if (_isLoading || !_hasMore) return; _isLoading = true; notifyListeners(); try { // final events = await apicall.geteventsdatapagelimit(_page, _limit); final listallnotes = await call_api.getallnotes(_page, _limit); if (listallnotes!.isEmpty) { _hasMore = false; } else { listnotes.addAll(listallnotes); _page++; // notifyListeners(); } } catch (e) { } finally { _isLoading = false; notifyListeners(); } // final listallnotes = await call_api.getallnotes(); // print("Hiiiiiilistallnotes : ${listallnotes}"); // listnotes = listallnotes!; // notifyListeners(); } }