import 'package:flutter_contacts/flutter_contacts.dart'; // Service to manage contact-related operations class ContactService { Future> fetchContacts() async { if (await FlutterContacts.requestPermission()) { return await FlutterContacts.getContacts( withProperties: true, withThumbnail: true, withAccounts: true, withGroups: true, withPhoto: true); } return []; } Future> fetchFavoriteContacts() async { // Fetch all contacts List contacts = await fetchContacts(); // Filter contacts to only include those with isStarred: true List favoriteContacts = contacts.where((contact) => contact.isStarred).toList(); return favoriteContacts; } Future addNewContact(Contact contact) async { await FlutterContacts.insertContact(contact); } }