Getx: i have installed the package imported used snack bar and nothing happen

Created on 28 May 2020  路  10Comments  路  Source: jonataslaw/getx

the title as enough

All 10 comments

please write the snippet of your code

the title as enough

Please follow the issue form, inserting the reproduction code, description of the problem, expected behavior, version of Flutter, and version of Get, otherwise it will not be possible to follow up on this issue.

the title as enough

Please follow the issue form, inserting the reproduction code, description of the problem, expected behavior, version of Flutter, and version of Get, otherwise it will not be possible to follow up on this issue.

version is latest flutter and the latest package version, onprsesd button i m calling the get.snackbar(); but nothing happen even not showing in error

Follow the documentation, you skipped the first step which is to exchange MaterialApp for GetMaterialApp

Hi, i already change MaterialApp to GetMaterialApp but still nothing
this lines is showed on console

I/flutter (31797): [OPEN SNACKBAR] snackbar
I/flutter (31797): [CLOSE SNACKBAR] snackbar

but nothing happen on phone screen

Oh, nevermind. I figure out the problem. I use the Snackbar to show error before closing the screen (Get.back()).

But, directly calling Get.back() will directly close the snack bar. So, it appears as nothing happens

I think it's good to add docs about not calling Get.back() directly after snackbar without a delay.

Get.back() do the same as Navigator.pop(). So the default behavior is to close as soon as you call. I can't think on a reason to add a delay to close routes

Why you need to call the function that closes the snackbar right after you open it @alifgiant ?

Get.back() do the same as Navigator.pop()

Yes figured that out back then.

Hmm, I don't need a function that close snackbar right after I open it. The use-case is like this, A user is failed in doing something on screen B, then the app shows a snack bar before closing the screen and back to screen A.

Sure, I can await the screen B then check its result before showing snackbar. But if screen B can be opened from multiple other screens, it's a chore to add it in all other places.

My previous suggestion is just add somewhere on the doc "don't call Get.back() right after you show a snackbar". Because for first timer users like me, will found it weird because nothing happens after a refactor adopting GetX.

Even though it didn't take me a lot of time to figure it out, I think it will be a nice addition to docs.

make sense, i'll do a small update in the docs

The point is not to warn the user "not to use", not least because many users use Get.back() precisely to close snackbars, and not the screens.
I don't remember if I explicitly put in the documentation that Get.back() closes any overlay, regardless of routes, snackbars, dialogs, etc. If not, maybe it would be a good addition.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aztecrabbit picture aztecrabbit  路  3Comments

aytunch picture aytunch  路  4Comments

ad-on-is picture ad-on-is  路  3Comments

R-Praveen picture R-Praveen  路  4Comments

GoldenSoju picture GoldenSoju  路  3Comments