1

Does anyone know the reason for the blue lines??

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

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
praw
  • 19
  • 4
  • 2
    It's from linter. It suggests you to add const keyword for those widgets. – Midhun MP Oct 12 '21 at 07:53
  • 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 – praw Oct 12 '21 at 07:59
  • Check this answer to get an idea about use of const: https://stackoverflow.com/questions/51576209/flutter-variable-with-const-keyword/51576842 – Midhun MP Oct 12 '21 at 08:02

2 Answers2

2

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

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
0

it just tells you if you do this your code would work better or would be more readable. in this case, adding const to your Icon would make this widget not to rebuild completely from scratch and use data that have been stored in ram

Ardeshir ojan
  • 1,914
  • 1
  • 13
  • 36