I have some methods that require the buildContext, e.g. popping the current page, showing modals, hiding the snackBar.
I'm not sure which would be the better solution for the methods to obtain the buildContext:
- Creating a global key of the scaffold state and calling the global key's currentContext,
- Passing the buildContext from the build method all the way down to the current method
Is there a difference between the two ways? Or if they're equally suitable in the situation, is one way preferred over or is of better convention than the other?
Thanks