How to control obscured fields on background with Flutter

134 Views Asked by At

I am developing an app with Flutter/Dart and GetX. I have a boolean variable named "obscureText". When this variable is true, specific text fields' inputs are all visible. When this variable is false, specific text field's inputs are all obscured. (like '*****'). What I want is that when user exits from app via home button or task mode, app is running on background right? When app enters background mode, i want "obscureText" variable to be false automaticly. How can i achieve that?

1

There are 1 best solutions below

1
Stefan Galler On

You could use WidgetsBindingObserver to detect a change of AppLifecycleState and update your value when the state is paused.