What is the reason for the blue underline? Flutter

1,042

It's a linter warning. Usually it tells you about the best practices that can improve your code quality.

In this case, it is asking you to use const keyword for those widgets while initialising. The exact rule for this warning can be found here: prefer_const_constructors.

You can check all the linter rules here

Share:
1,042
praw
Author by

praw

Updated on January 01, 2023

Comments

  • praw
    praw over 1 year

    Does anyone know the reason for the blue lines??

    When I double the size variable, the blue underlines turn into red underlines.
    screenshot

    • Midhun MP
      Midhun MP over 2 years
      It's from linter. It suggests you to add const keyword for those widgets.
    • praw
      praw over 2 years
      Do classes have to be const? i am new to this language. When I don't const the classes the app works but the blue underlines are annoying
    • Midhun MP
      Midhun MP over 2 years
      Check this answer to get an idea about use of const: stackoverflow.com/questions/51576209/…
  • praw
    praw over 2 years
    Thanks for the info, I'm new so I couldn't rate your answer