I want to display a Snackbar when an error is detected in some function, let it called function C. So my StatefulWidget calls function A, A calls function B, B calls function C and there I have an 'if statement' to decide whether to display the SnackAbar. The trivial solution is to pass the context
or globalKey
as a parameter through functions A, B and C. and C will use it to display the Snackbar. But this is definitely not a nice solution and I am definitely not the first to face such a dilemma, What is the cleanest and most efficient way to do this?
Thanks
Aucun commentaire:
Enregistrer un commentaire