How to hide app preview when switching apps, with Flutter.
This is an important feature when your app displays sensitive data.
If you’re showing sensitive data, eg. a wallet amount, or simply when a login form shows the password inserted in clear (think at eye icon..), you have to hide sensitive data when you aren’t in the app.
A lot of apps already do so, either on Android or iOS.
Today we will see how to accomplish this task without using any package and write all the code on our own. Don’t worry, it’s easy.
So, go on and see how to hide the app preview when you switch from one app to another.
Get Started
Now, let’s start coding!
Create a new basic Flutter app. ( I suppose you know how to do that ^^ ).
Android
In Android, it’s super easy.
We only need to update the MainActivity.kt into your android native project adding only one line of code in the onCreate method.