free_contact_picker 0.1.0 copy "free_contact_picker: ^0.1.0" to clipboard
free_contact_picker: ^0.1.0 copied to clipboard

Flutter plugin for pick contact on Android without any permission. With this plugin a Flutter app can ask its user to select a contact from his/her address book. The information associated with the co [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:contact_picker/contact_picker.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  final _contactPickerPlugin = ContactPicker();
  String _contactName = '';
  String _contactPhone = '';

  void pickContact() {
    _contactPickerPlugin.pickContact(
      (contact) {
        setState(() {
          _contactName = contact['name'];
          _contactPhone = contact['phone'];
        });
      },
      onError: (error) {
        debugPrint(error);
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Text('ContactName: $_contactName'),
              Text('ContactPhone: $_contactPhone'),
              FilledButton(onPressed: pickContact, child: Text('Pick Contact')),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
0
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for pick contact on Android without any permission. With this plugin a Flutter app can ask its user to select a contact from his/her address book. The information associated with the contact is returned to the app.

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on free_contact_picker

Packages that implement free_contact_picker