Provider.of<Products>(context, listen: false)
.addProducts(_editedProduct)
.catchError((error) {
return showDialog<Null>(
context: context,
builder: (ctx) {
return AlertDialog(
title: Text(
'An error occurred',
),
content: Text('SomethingWent Wrong'),
actions: [
FlatButton(
child: Row(
children: [
Icon(Icons.close),
Text('Close'),
],
),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
},
);
}).then((value) {
setState(() {
_isLoading = false;
});
Navigator.of(context).pop();
});
I was able to display an alert dialogue but I coundn't show the title. I am unable to find the reason. Everything is working fine except the title is not displaying.
Try this and see if it works.