contacts_helper 0.0.3 copy "contacts_helper: ^0.0.3" to clipboard
contacts_helper: ^0.0.3 copied to clipboard

PlatformAndroid

A flutter plugin to help you get the device's contacts. Only Android.

example/lib/main.dart

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

import 'package:contacts_helper/contacts_helper.dart';
import 'package:permission_handler/permission_handler.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    _requestPermissions();
  }

  Future<void> _requestPermissions() async {
    PermissionStatus status = await Permission.contacts.request();
    if (status == PermissionStatus.granted) {
      _getContacts();
    }
  }

  _getContacts() {
    ContactsHelper.getContacts().then((value) {
      print(value);
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Container(),
      ),
    );
  }
}
1
likes
110
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin to help you get the device's contacts. Only Android.

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on contacts_helper