Gibt es eine einfache, Standardmethode, um Pops abzufangen, während der Widget -Baum noch verfügbar ist?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Gibt es eine einfache, Standardmethode, um Pops abzufangen, während der Widget -Baum noch verfügbar ist?

by Guest » 24 Feb 2025, 03:18

Im Moment habe ich < /p>
return PopScope(
canPop: false,
onPopInvokedWithResult: (bool didPop, Object? result) async {
if (result == null){
final navigator = Navigator.of(context);
await _save();
navigator.pop(true);
}
},
< /code>
Was funktioniert, aber ich bin mir sicher, dass es zuverlässig ist. Das liegt daran, dass _save () davon abhängt, Informationen aus dem Widget -Baum abzurufen. Ich mag es auch nicht, wie ich das Catch -System interpretiere, indem ich dieses Ergebnis überprüfe == NULL. Auch hier scheint es unzuverlässig. Ich bin mir auch nicht sicher, ob die asynchrische Funktion akzeptabel ist. Bonusfrage: Gibt es eine Möglichkeit, Push ? )

Top