First I created extracted class of the re-usable card which was repeated in my code.
Here I am trying to use the key in different places where it throw no such error but here below in the code it shows this error.
class ReusableCard extends StatelessWidget {
const ReusableCard({super.key, required this.colour})
final Color colour;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
color: colour,
borderRadius: BorderRadius.circular(10.0),
),
);
}
}
How to this error can be solved.
CodePudding user response:
It is missing end ;
on constructor like
class ReusableCard extends StatelessWidget {
const ReusableCard({super.key, required this.colour}); //here ;
CodePudding user response:
Try the following code:
class ReusableCard extends StatelessWidget {
const ReusableCard({super.key, required this.colour});
final Color colour;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
color: colour,
borderRadius: BorderRadius.circular(10.0),
),
);
}
}