When i press back button on screen 1 . open another page . when again press back button . open screen 1 . app not close . can anyone suggestion me
show us your back pressed button event blocks…
its on diffrent page
Do you want achieve both on back pressed…? Then use index method.
You Can Give Me Other Options.
how can i use index method
Did you answer this?
yes i want to use both
Actually you cannot use both…
imagine
If first event triggered on back pressed, open another screen, then you come back and again while you press back then again the first event only will trigger. Instead think other way
Use some label click to open another screen and
Or you have to save the index value every time you back press and call the index
how can i use index
Initialize one variable with zero
On Back preßsed
Set that global index to get index +1
If get index =1
Open another screen
Else
Set index to zero
Close the Application
I repeat , in the above step, index 2 will never trigger unless you save this index value intinydb or share value