패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.13

flutter_native_contact_picker

주소록에서 연락처를 선택하기 위한 플러터 플러그인입니다.

AndroidiOS
30일 다운로드
5.8만
좋아요
82
Pub 점수
160

패키지 설치

flutter pub add flutter_native_contact_picker

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Android 및 iOS 기기의 네이티브 주소록에서 직접 연락처를 선택할 수 있는 플러터 플러그인입니다. 플랫폼에 맞는 자연스러운 인터페이스를 제공하여 다양한 플랫폼 간 일관된 사용자 경험을 보장합니다. 장치 내장 연락처 시스템과 통합되어 이름, 전화번호, 이메일 등 연락처 정보에 접근할 수 있습니다. 단순성과 신뢰성을 고려해 설계되었으며, 커스텀 연락처 선택기를 만들지 않고도 연락처 통합이 필요한 앱에 적합합니다.

사용 사례

  • 메시징 앱에서 연락처 선택 통합
  • 연락처 가져오기를 통한 사용자 프로필 생성 활성화
  • 빠른 연락처 공유 촉진
  • 연락처 검색을 통한 약속 예약 지원
  • 연락처 검색을 사용하여 CRM 도구 구축

주요 기능

  • Android 및 iOS의 네이티브 연락처 선택기 UI
  • 이름 및 전화번호와 같은 연락처 세부 정보에 대한 액세스
  • 연락처 선택을 위한 간단한 API
  • 크로스 플랫폼 호환성
  • 플랫폼 권한을 사용한 안전한 데이터 처리

적합한 대상

  • 통신 앱을 개발하는 개발자
  • 연락처 가져오기 기능이 필요한 앱
  • 리드 생성 또는 네트워킹을 위한 도구
  • 연락처 입력이 필요한 모바일 양식
  • 사용자 온보딩 흐름이 있는 애플리케이션

고려 사항

  • Android 및 iOS에서 런타임 권한이 필요합니다
  • 모든 연락처 필드(예: 사진)를 지원하지 않을 수 있습니다
  • 기기의 네이티브 연락처 데이터베이스에 의존합니다
  • 피커 UI의 사용자 정의가 제한적
  • 권한 거부에 대한 적절한 오류 처리가 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_native_contact_picker

With this plugin a Flutter app can ask its user to select a contact or contacts from their address book, with the option to select specific phone numbers. The information associated with the contacts is returned to the app.

This plugin uses the operating system's native UI for selecting contacts and does not require any special permissions from the user, even on Android.

Features

  • [x] iOS Support

    • Select single contact
    • Select multiple contacts
    • Select specific phone number from a contact
    • Returns all phone numbers for selected contacts
  • [x] Android Support

    • Select single contact
    • Select specific phone number from a contact
    • No READ_CONTACTS permission required

Usage

Basic Contact Selection
// Create an instance of the picker
final FlutterNativeContactPicker _contactPicker = FlutterNativeContactPicker();

// Select a single contact
Contact? contact = await _contactPicker.selectContact();
print(contact?.fullName);
print(contact?.phoneNumbers);

// Select multiple contacts (iOS only)
List<Contact>? contacts = await _contactPicker.selectContacts();
for (var contact in contacts ?? []) {
  print(contact.fullName);
  print(contact.phoneNumbers);
}
Phone Number Selection
// Select a specific phone number from a contact
Contact? contact = await _contactPicker.selectPhoneNumber();
print(contact?.fullName);
print(contact?.selectedPhoneNumber); // The specifically selected number
print(contact?.phoneNumbers); // All available numbers (iOS only)

Contact Model

The Contact class provides the following properties:

class Contact {
  final String? fullName;           // Contact's full name
  final List<String>? phoneNumbers; // All phone numbers (iOS: all numbers, Android: selected number only)
  final String? selectedPhoneNumber; // The specifically selected phone number when using selectPhoneNumber()
}

Platform Differences

iOS
  • Minimum iOS 13.0 (Swift Package Manager integration and Flutter FlutterFramework requirement)
  • Supports selecting multiple contacts
  • Returns all phone numbers associated with a contact
  • When using selectPhoneNumber(), returns both the selected number and all available numbers
  • Uses native CNContactPickerViewController
Android
  • Single contact selection only
  • When using selectPhoneNumber(), returns only the selected phone number
  • No READ_CONTACTS permission required
  • Uses native contact picker intent

Example

See the example directory for a complete sample app demonstrating all features.

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final FlutterNativeContactPicker _contactPicker = FlutterNativeContactPicker();
  List<Contact>? _contacts;
  String? _selectedPhoneNumber;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Contact Picker Example App'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              MaterialButton(
                color: Colors.blue,
                textColor: Colors.white,
                child: const Text("Select Contact"),
                onPressed: () async {
                  Contact? contact = await _contactPicker.selectContact();
                  setState(() {
                    _contacts = contact == null ? null : [contact];
                    _selectedPhoneNumber = null;
                  });
                },
              ),
              MaterialButton(
                color: Colors.green,
                textColor: Colors.white,
                child: const Text("Select Phone Number"),
                onPressed: () async {
                  Contact? contact = await _contactPicker.selectPhoneNumber();
                  setState(() {
                    _contacts = contact == null ? null : [contact];
                    _selectedPhoneNumber = contact?.selectedPhoneNumber;
                  });
                },
              ),
              if (_contacts != null) ...[
                ..._contacts!.map(
                  (contact) => Column(
                    children: [
                      Text(contact.fullName ?? 'No name'),
                      if (_selectedPhoneNumber != null)
                        Text('Selected: $_selectedPhoneNumber'),
                      ...?contact.phoneNumbers?.map((number) => Text(number)),
                    ],
                  ),
                ),
              ],
            ],
          ),
        ),
      ),
    );
  }
}

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.0.2

소스 저장소

이 패키지를 사용하는 프로젝트