skip to Main Content

The second image is the one without curly braces, and it marks that area with a red line.
The first image has curly braces inserted in it, and the line disappeared. Why was there a need to add curly braces?

Screenshot 1

Screenshot 2

I tried without the curly braces as shown in the tutorial, but it showed error.

2

Answers


  1. class QuoteCard extends StatelessWidget {
      const QuoteCard({super.key}) <-- missing semi colon here
    

    you are missing a semi colon after the constructor, a curly brace is not required before the override annotation.

    Login or Signup to reply.
    1. Use key with the contructor and end the line by using semicolon like this:

    const QuoteCard({super.key, required this.quote});

    1. Then there is no error before the @override

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search