15 lines
456 B
Dart
15 lines
456 B
Dart
import 'package:flutter_contacts/flutter_contacts.dart';
|
|
|
|
// Service to manage contact-related operations
|
|
class ContactService {
|
|
Future<List<Contact>> fetchContacts() async {
|
|
if (await FlutterContacts.requestPermission()) {
|
|
return await FlutterContacts.getContacts(withProperties: true, withThumbnail: true);
|
|
}
|
|
return [];
|
|
}
|
|
|
|
Future<void> addNewContact(Contact contact) async {
|
|
await FlutterContacts.insertContact(contact);
|
|
}
|
|
} |