Phone contact list with package

Custom Code

Hi everyone!

I am trying to get access and list all contacts from phone.

I am using flutter_contacts https://pub.dev/packages/flutter_contacts

I have trouble to list displayName and phone number in a Listview.

My action custom code as JSON return value

// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:flutter_contacts/flutter_contacts.dart';

Future<dynamic> listContactFromPhoneBook() async {
  // create action will list contacts from phone book
  List<Contact> contacts =
      await FlutterContacts.getContacts(withProperties: true, withPhoto: false);
  return contacts;
}

I got the contact phone list but I want to bind displayName and phone.

What have you tried so far?

I created a custom action

I created an action on component initialization with contact permission and custom action

I bound my listView with Action Output

Then I tried to bound my text with displayName using JSON Path like $.displayName or $.contact.displayName. I tried in many ways but I just got JSON structure or fail.

Any help?

Did you check FlutterFlow's Documentation for this topic?
Yes
1
3 replies