const, final, dynamic, var... when and why? | Dart & Flutter tutorial

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 2

  • @piffyization
    @piffyization 2 роки тому +1

    Thanks for your video. I have a quick question. Const is compile time, does that mean better performance? (even if minimal). Or do you recommend using final for constants.

    • @DavidSerranoIO
      @DavidSerranoIO  2 роки тому +2

      I think that yes, it means better performance in the end. You should always use const when possible, also, take a look at the following lint rules:
      - dart-lang.github.io/linter/lints/prefer_const_declarations.html
      - dart-lang.github.io/linter/lints/prefer_const_constructors.html