Skip to content

fail to sync addressbook #1

@raakeshks7

Description

@raakeshks7

Null pointer exception while syncing addressbook

In user.dart -> setContacts()

Future<void> setContacts() async {
    await setUpContacts();
    var firestore = FirebaseFirestore.instance.collection('users');
    print('2');
    for (final contact in _phoneContacts) {
      print('3');
      for (final phone in contact.phones) {
        print('4');
        final res = await firestore
            .where('phoneNumber', isEqualTo: phone.normalizedNumber)
            .get();
        print('5');
        res.docs.forEach((querySnapShot) {
          print('6');
          _currentUserContacts.add(MyUser(
              phoneNumber: querySnapShot.data()['phoneNumber'],
              userId: querySnapShot.id
              profilepic: querySnapShot.data()['profilePic'],
              displayName: contact.displayName));
        });
      }
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions