我试图为我的脚手架小部件设置颜色阴影,但我收到了这个错误。
没有为类“Color”定义运算符“[]”。尝试定义运算符'[]'。
在我之前做的一个项目中,我没有这个问题。有谁知道我可能做错了什么?
使用的代码:
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black[900],
appBar: AppBar(
title: Text('My App'),
centerTitle: true,
),
);
}
}