flutter_simple_contact 0.0.1
flutter_simple_contact: ^0.0.1 copied to clipboard
Lightweight (~2KB) contact fetching plugin for Flutter with zero dependencies. Built for fintech/enterprise apps requiring transparent, auditable contact access.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.0.1 - 2026-01-08 #
๐ Initial Release #
First public release of flutter_simple_contact - a lightweight, transparent contact fetching plugin for Flutter with zero third-party dependencies.
โจ Features #
Core Functionality
- Android Support: Full support for Android API 21+ using native
ContactsContractprovider - iOS Support: Full support for iOS 13.0+ using native
CNContactStoreContacts framework - Zero Dependencies: No third-party packages - direct native implementation only
- Lightweight: ~5KB package size for maximum efficiency
Contact Modes
- Unified Contacts: Fetch aggregated contacts (default, works on both platforms)
- Raw Contacts: Fetch per-account raw contacts (Android only)
- Automatic fallback handling for platform-specific limitations
Permission Management
- Built-in Permission Handling: Automatic runtime permission requests
- Manual Permission Mode: Disable auto-handling for custom flows
- Permission Status Tracking: Detailed error codes for denied/permanently denied states
- Platform-specific permission dialogs (Material for Android, Cupertino for iOS)
Data Fetching Options
Minimal Mode (minimizeData: true)
- Contact ID
- Display name
- Phone numbers with labels
- Photo availability flag
- Starred/favorite status (Android only)
- Last modified timestamp (Android only)
Full Metadata Mode (minimizeData: false)
- All minimal mode fields, plus:
- Email addresses with labels
- Postal addresses (street, city, state, postal code, country, ISO code, labels)
- Websites with labels
- Organizations (company, department, job title)
- Notes (iOS: requires entitlement; Android: included)
- Social profiles (keys included for future use)
- Birthdays (keys included for future use)
- Relations (keys included for future use)
Filters
onlyWithPhone: Skip contacts without phone numbersonlyStarred: Only starred/favorite contacts (Android only)onlyWithPhoto: Only contacts with profile photos
Sorting
none: Default system orderalphabetical: Sort by display name (locale-aware)lastUpdatedDesc: Sort by last modified timestamp (Android only)
Advanced Features
- EventChannel Progress: Optional progress events for large contact lists
- Cancel Support: Cancel ongoing fetch operations via
cancelFetch() - Raw Map API: Flexible JSON-like output for backend integration
- Typed API: Strongly-typed Dart models for type safety
- iOS Notes Support: Optional with entitlement flag (
includeNotes)
๐ Security & Privacy #
- Transparent source code (auditable by enterprises)
- No data sent to third parties
- Respects platform permission models
- Optional minimal data collection mode
- Clear permission rationale requirements
๐ฑ Platform-Specific Implementations #
Android
- Uses
ContactsContract.Contactsfor unified contacts - Uses
ContactsContract.RawContactsfor raw contact mode - Queries
ContactsContract.Datatable for rich metadata (emails, addresses, websites) - Runtime permission handling via
ActivityCompat - Supports filters: starred, hasPhoto, hasPhone
- Returns
lastModifiedMillistimestamp where available
iOS
- Uses
CNContactStore.enumerateContactsfor efficient fetching keysToFetchoptimization to avoid unauthorized key errors- Conditional
CNContactNoteKeybased onincludeNotesflag - Handles
.notDetermined,.denied,.restricted,.authorizedstates - Returns structured postal addresses with ISO country codes
- Organization data (company, department, job title) from contact fields
๐ ๏ธ APIs #
Methods
FlutterSimpleContact.fetchContactsRaw(): Returns raw mapsFlutterSimpleContact.fetchContacts(): Returns typedSimpleFetchResultFlutterSimpleContact.cancelFetch(): Cancel ongoing operationFlutterSimpleContact.progressStreamRaw(): Listen to progress events
Models
SimpleFetchOptions: Main configuration objectSimpleFetchFilters: Contact filtering optionsSimpleAdvancedOptions: Progress events and iOS notes configSimpleFetchResult: Typed result with status/error handlingSimpleContact: Typed contact modelSimplePhone: Phone number with label
๐ Configuration Options #
| Option | Type | Default | Description |
|---|---|---|---|
handlePermission |
bool |
true |
Auto-request permissions |
mode |
String |
"unified" |
Contact mode (unified/raw) |
sort |
String |
"none" |
Sort order |
minimizeData |
bool |
false |
Fetch only name + phones |
onlyWithPhone |
bool |
false |
Filter: has phone |
onlyStarred |
bool |
false |
Filter: starred (Android) |
onlyWithPhoto |
bool |
false |
Filter: has photo |
enableProgressEvents |
bool |
false |
Enable progress stream |
includeNotes |
bool |
false |
Fetch notes (iOS entitlement required) |
๐ Known Limitations #
- iOS Starred Contacts: Not exposed by Apple's Contacts framework (returns error if
onlyStarred: trueon iOS) - iOS Raw Contacts: Not available (iOS only provides unified contacts)
- iOS Last Modified: Timestamp not reliably available via public API
- iOS Notes: Requires
com.apple.developer.contacts.notesentitlement - Android Website Labels: Manual mapping (no native
getTypeLabel()helper)
๐ฆ Package Info #
- Minimum Flutter SDK: 3.22.0
- Minimum Dart SDK: 3.9.0
- Android Minimum SDK: API 21 (Android 5.0 Lollipop)
- iOS Minimum Version: 13.0
- Package Size: ~5KB
- Dependencies: 0 (zero third-party packages)
๐งช Testing #
- Tested on Android emulator (API 34)
- Tested on iOS simulator (iOS 17)
- Verified with 7+ test contacts
- Permission flows validated on both platforms
- Error handling tested (denied/permanently denied states)
๐ Documentation #
- Complete README with usage examples
- Inline code documentation
- Platform setup instructions
- Error handling guide
- Performance optimization tips
- Platform differences table
๐ Credits #
Developed by Gunjan Sharma (Full Stack System Architect & Tech Lead)
[Unreleased] #
Planned Features (Community Requested) #
- Progress UI helper widget
- Contact write operations (create/update/delete)
- Contact groups support
- SIM-specific contacts filter (Android)
- Contact usage frequency (where available)
- Batch operations for large contact lists