Flutter — setEnabledSystemUIOverlays is deprecated and shouldn’t be used. Migrate to setEnabledSystemUIMode

How to migrate to setEnabledSystemUIMode

I was using the following code to show only status bar.

but it started giving me a warning:

setEnabledSystemUIOverlays is deprecated and shouldn’t be used. Migrate to setEnabledSystemUIMode.

Solution