You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had the same problem when calling snackbar from the main() function, but moving the snackbar call to onInit of a GetXController class that gets created during application startup did the trick and now works perfectly on startup.
At the time you called the snackbar, the widget tree Overlay was not ready yet.
If you use the Snackbar in main(), or onInit(), or initState(), it will trigger an error, perhaps this is not so obvious, but all of this is called before the build process is completed, so how do you Will display a widget if the tree is not ready yet?
But I'm here to give you the solution:
I'm using Get.snackbar() in onInit():
Just stop! Use in onReady, this function was created for this.
I'm using Get.snackbar() in main():
I recommend you look for a better place to insert your snackbar, but it will work with tip 3, in the same way. So If you really need it, just follow it.
I'm using it in initState (or main()), and I can't change it.
There is a native feature (which is also documented) that solves this with a single parameter: Get.snackbar("dsds", "dsds",instantInit: false);
instantInit: false will wait for the widget tree to be ready and send the snackbar.
Description
Solution(not good)
The text was updated successfully, but these errors were encountered: