Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have problem in build context #12

Open
Apyxxx opened this issue Feb 28, 2023 · 0 comments
Open

I have problem in build context #12

Apyxxx opened this issue Feb 28, 2023 · 0 comments

Comments

@Apyxxx
Copy link

Apyxxx commented Feb 28, 2023

Don't use 'BuildContext's across async gaps.
it is showing in select_contacts_repository.dart file :

void selectContact(Contact selectedContact, BuildContext context) async {
try {
var userCollection = await firestore.collection('users').get();
bool isFound = false;

  for (var document in userCollection.docs) {
    var userData = UserModel.fromMap(document.data());
    String selectedPhoneNum = selectedContact.phones[0].number.replaceAll(
      ' ',
      '',
    );
    if (selectedPhoneNum == userData.phoneNumber) {
      isFound = true;
      
      //from here showing error.....
      Navigator.pushNamed( context, MobileChatScreen.routeName,  arguments: {
        
          'name': userData.name,
          'uid': userData.uid,
          'isGroupChat' : userData.groupId,
          'profilePic' : userData.profilePic,
          
        },
      );
    }
  }

i tried adding
if (!mounted) return;
but it didn't work I think I didn't know how to use it

hope I can get some help
and think you for this amazing app!!

@Apyxxx Apyxxx changed the title Hello, think you for this cool app I have problem in build context Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant