I would appreciate it if you could tell me how to correct the error.
CodePudding user response:
StatefulWidget
is malformed. The build
method must be implemented in State.
class MyHomePage extends StatefulWidget {
final String title;
MyHomePage({required this.title});
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
///your Code
}
}
CodePudding user response:
The structure of your stateful widget looks wrong
class YellowBird extends StatefulWidget {
const YellowBird({ Key? key }) : super(key: key);
@override
State<YellowBird> createState() => _YellowBirdState();
}
class _YellowBirdState extends State<YellowBird> {
@override
Widget build(BuildContext context) {
return Container(color: const Color(0xFFFFE306));
}
}