fast_contacts 1.0.0
fast_contacts: ^1.0.0 copied to clipboard
A faster way of accessing device's contacts list
fast_contacts #
A much faster alternative to contacts_service and flutter_contact for reading the device's contact book.
This plugin uses recommended approaches on both platforms to achieve optimal query performance.
Usage #
To use this plugin, add fast_contacts
as a dependency in your pubspec.yaml
file.
Permissions #
Android #
Add the following permission to your AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_CONTACTS" />
iOS #
Set the NSContactsUsageDescription
in your Info.plist
file
<key>NSContactsUsageDescription</key>
<string>Description of why you need the contacts permission.</string>
Note
fast_contacts
doesn't handle permissions. Use special plugins (like permission_handler) to ask for the permission before accessing contacts.
Example #
// Import package
import 'package:fast_contacts/fast_contacts.dart';
// Get all contacts
final contacts = await FastContacts.allContacts;
// Get first contact's image (thumbnail)
final thumbnail = await FastContacts.getContactImage(contacts[0].id);
// Get first contact's image (full size)
final thumbnail = await FastContacts.getContactImage(contacts[0].id, size: ContactImageSize.fullSize);
For a more complete usage example, see example
project.
Limitations #
- Currently, only basic contact info (id, displayName, phones) is fetched for each contact. A custom projection support is planned for the future (PR's are welcome!).
Performance #
[Android: Samsung Galaxy S8]
[iOS: iPhone 8]