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

preview_player
Показать описание
One of the first things explained in most tutorials is the declaration of variables. In Dart, you could declare those with const, final, dynamic, var, and by using the type itself; but what are their differences and when should we use each one?

In this video I'll try to define each of them and give you some tips to know which one to use depending on the context.

🔔 Subscribe to my channel to see more videos like this:

📖 Useful resources:

- "Flutter: Performance analysis of `const` constructor" by Crizant Lai:
- Dart language tour:

🔤 Text version of the video:

🔵 Follow me for more content like this:

⏳ Timecodes:
00:00 - Introduction
00:28 - var
01:58 - dynamic
03:00 - final
03:36 - const
04:24 - const in the context of Flutter
04:56 - Final words
Рекомендации по теме
Комментарии
Автор

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.

piffyization
visit shbcf.ru