Pakete, Repositories und App-Kategorien suchen

Paketdetailsv0.6.3

contacts_service

Ein Flutter-Plugin zum Abrufen und Verwalten von Kontakten auf Android- und iOS-Geräten.

AndroidiOS
30-Tage-Downloads
2880
Likes
599
Pub-Punkte
140

Paket installieren

flutter pub add contacts_service

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Das contacts_service-Paket ist ein Flutter-Plugin, das Entwicklern ermöglicht, auf Kontakte des Geräts unter Android und iOS zuzugreifen und sie zu verwalten. Es bietet eine konsistente API zum Abrufen von Kontaktlisten, zum Lesen von Kontaktinformationen wie Namen, Telefonnummern und E-Mail-Adressen sowie zur Unterstützung grundlegender Operationen wie Filtern und Suchen. Aufgrund seiner plattformübergreifenden Kompatibilität vereinfacht es die Integration mit den nativen Kontakt-Systemen, ohne dass plattformspezifischer Code erforderlich ist. Das Paket ist ideal für Anwendungen, die Kontaktabfragen oder Importfunktionen benötigen.

Anwendungsfälle

  • Abrufen der Kontaktliste
  • Kontakt-Suche und Filterung
  • Kontakte in Apps importieren
  • Kontakte mit App-Daten synchronisieren
  • Anzeigen von Kontaktdaten in der Benutzeroberfläche

Hauptmerkmale

  • Plattformübergreifende Unterstützung (Android & iOS)
  • Einfache API für Kontaktspeicherzugriff
  • Unterstützt Kontaktfelder wie Name, Telefon, E-Mail
  • Such- und Filterfunktionen
  • Kein natives Code erforderlich

Geeignet für

  • Apps, die Kontaktzugriff benötigen
  • Benutzerprofil-Importtools
  • Kommunikations-Apps
  • CRM-Integrationen
  • Kontakt-Auswahl-Widgets

Hinweise

  • Laufzeitberechtigungen unter Android und iOS erforderlich
  • Beschränkt auf grundlegende Kontaktvorgänge
  • Datenschutzkonformität erforderlich
  • Kann Benutzerzustimmung zum Zugriff erfordern
  • Die Leistung hängt von der Größe der Kontaktdatenbank des Geräts ab

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

contacts_service

pub package Build Status Coverage Status

A Flutter plugin to access and manage the device's contacts.

Usage

To use this plugin, add contacts_service as a dependency in your pubspec.yaml file.
For example:

dependencies:  
    contacts_service: ^0.6.3

Permissions

Android

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_CONTACTS" />  
<uses-permission android:name="android.permission.WRITE_CONTACTS" />  
iOS

Set the NSContactsUsageDescription in your Info.plist file

<key>NSContactsUsageDescription</key>  
<string>This app requires contacts access to function properly.</string>  

Note
contacts_service does not handle the process of asking and checking for permissions. To check and request user permission to access contacts, try using the following plugins: flutter_simple_permissions or permission_handler.

If you do not request user permission or have it granted, the application will fail. For testing purposes, you can manually set the permissions for your test app in Settings for your app on the device that you are using. For Android, go to "Settings" - "Apps" - select your test app - "Permissions" - then turn "on" the slider for contacts.

Example

// Import package  
import 'package:contacts_service/contacts_service.dart';  
  
// Get all contacts on device
List<Contact> contacts = await ContactsService.getContacts();  

// Get all contacts without thumbnail (faster)
List<Contact> contacts = await ContactsService.getContacts(withThumbnails: false);

// Android only: Get thumbnail for an avatar afterwards (only necessary if `withThumbnails: false` is used)
Uint8List avatar = await ContactsService.getAvatar(contact);
  
// Get contacts matching a string
List<Contact> johns = await ContactsService.getContacts(query : "john");

// Add a contact  
// The contact must have a firstName / lastName to be successfully added  
await ContactsService.addContact(newContact);  
  
// Delete a contact
// The contact must have a valid identifier
await ContactsService.deleteContact(contact);  

// Update a contact
// The contact must have a valid identifier
await ContactsService.updateContact(contact);

// Usage of the native device form for creating a Contact
// Throws a error if the Form could not be open or the Operation is canceled by the User
await ContactsService.openContactForm();

// Usage of the native device form for editing a Contact
// The contact must have a valid identifier
// Throws a error if the Form could not be open or the Operation is canceled by the User
await ContactsService.openExistingContact(contact);

Contact Model

// Name
String displayName, givenName, middleName, prefix, suffix, familyName;

// Company
String company, jobTitle;

// Email addresses
List<Item> emails = [];

// Phone numbers
List<Item> phones = [];

// Post addresses
List<PostalAddress> postalAddresses = [];

// Contact avatar/thumbnail
Uint8List avatar;

Example

Contributions

Contributions are welcome! If you find a bug or want a feature, please fill an issue.

If you want to contribute code please create a pull request under the staging branch.

Credits

Heavily inspired from rt2zz's react native plugin

Kategorien

Abhängigkeiten

Abhängigkeiten 2 Einträge

Quell-Repository

Projekte, die dieses Paket verwenden