'Unable to hide status bar - Flutter - This expression has a type of 'void' so its value can't be used
Solution 1:[1]
You can set the StatusBar transparent by adding this in your main():
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent));
The problem is that you are putting it inside your runApp().
Your main() should look like this:
void main() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent));
runApp(const MyApp());
}
Solution 2:[2]
Try below code I think you write wrong code. for more refer this
void main() {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: Colors.red,//change color on your need
),
);
runApp(const MyApp());
}
Solution 3:[3]
You can add this Into your initState() method. this is hide the bottom navigation as well.It is use for Full Screen design.
@override void initState() { super.initState();
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.manual,
overlays: [],
);}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Ravindra S. Patil |
| Solution 3 |



