contact_picker 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 45

ContactPicker plugin for Flutter #

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.

This plugin uses the operating system's native UI for selection contacts and does not require any special permissions from the user.

Currently, the plugin only supports picking phone numbers. However, it should be easy to extend it to request other properties (e.g. addresses) from a contact or to optain the entire record for a contact (PRs are welcome).

Using the plugin #

Follow the Installing instructions on pub.

After that, instantiate ContactPicker in your Flutter app and call selectContact on it to bring up the UI for selecting a contact. The function returns with the selected Contact once the user has made a choice (or null if the user didn't select anything).

See example/lib/main.dart for an actual usage example.

[0.0.1]

  • Initial release

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final ContactPicker _contactPicker = new ContactPicker();
  Contact _contact;

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new Center(
          child: new Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
                new MaterialButton(
                  color: Colors.blue,
                  child: new Text("CLICK ME"),
                  onPressed: () async {
                    Contact contact = await _contactPicker.selectContact();
                    setState(() {
                      _contact = contact;
                    });
                  },
                ),
              new Text(_contact == null ? 'No contact selected.' : _contact.toString()),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  contact_picker: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:contact_picker/contact_picker.dart';
  
Version Uploaded Documentation Archive
0.0.2 Mar 17, 2018 Go to the documentation of contact_picker 0.0.2 Download contact_picker 0.0.2 archive
0.0.1+2 Sep 19, 2017 Go to the documentation of contact_picker 0.0.1+2 Download contact_picker 0.0.1+2 archive
0.0.1+1 Sep 19, 2017 Go to the documentation of contact_picker 0.0.1+1 Download contact_picker 0.0.1+1 archive
0.0.1 Sep 19, 2017 Go to the documentation of contact_picker 0.0.1 Download contact_picker 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
45
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.