初学Flutter在初始化Appbar的时候编译报了这个错误
void main(){
runApp(const MaterialApp(
title: 'Shopping App',
home: Scaffold(
appBar: AppBar(title: Text("HMOE")),
body: NavigatorWidget(),
),
));
}
去掉修饰MaterialApp的const解决了这个问题。
初学Flutter在初始化Appbar的时候编译报了这个错误
void main(){
runApp(const MaterialApp(
title: 'Shopping App',
home: Scaffold(
appBar: AppBar(title: Text("HMOE")),
body: NavigatorWidget(),
),
));
}
去掉修饰MaterialApp的const解决了这个问题。