0
votes
 updateDetails() async{  
           showDialog(   
              context: context,  
              builder: (BuildContext ctxt) {  
                return Container(  
                  child: AlertDialog(   
                    content: Row(   
                      children: [  
                        Container(  
                          child: Text("Updating profile..."),  
                        ),  
                        CircularProgressIndicator(),  
                      ],  
                    ),  
                  ),  
                );  
              });  
    await updateDetails();  
    //NOW I HAVE TO CLOSE THIS DIALOG  
    } 
1
Where you define updateDetails method? - John Joe
On another dart file - Kiran sreeram
Are you close alert dialogue automatically? - Ravindra S. Patil
@Kiransreeram please show us your button onPressed code . - John Joe

1 Answers

0
votes

When your loading of data is complete you have to call following code:

Navigator.pop(context);

Note: You should add return in front of showDialog for await to work.

Edit: If you are calling showDialog inside button press event, you can try following code:

showDialog();
await updateDetails();
Navigator.pop(context);

This will pop your dialog once update is complete.