Flutter代码报错:Expected ',' before this 解决方案咨询
Flutter错误"Expected ',' before this"解决办法
你的代码报错是因为Scaffold组件的appBar属性末尾缺少逗号,Dart语法要求类的多个命名参数之间必须用逗号分隔,appBar的闭合括号后没加逗号,导致编译器无法识别后面的body参数,从而抛出语法错误。
修正方法很简单,在appBar的AppBar(...)闭合括号后面添加逗号即可:
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('New project', style: TextStyle(fontSize:25, color: Colors.green, decorationStyle: TextDecorationStyle.dotted)), ), // 此处添加逗号 body: Center( child: Column( children: <Widget>[ Text('How many times pushed'), Text('ok') ], ), ), ); }
内容的提问来源于stack exchange,提问作者Nipuna Thalpage
相关产品推荐
相关产品推荐

