Тёмный

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

David Serrano
Подписаться 4,6 тыс.
Просмотров 2 тыс.
50% 1

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:
/ @davidserranoio
📖 Useful resources:
- "Flutter: Performance analysis of `const` constructor" by Crizant Lai:
/ flutter-performance-an...
- Dart language tour:
dart.dev/guides/language/lang...
🔤 Text version of the video:
davidserrano.io/const-final-d...
🔵 Follow me for more content like this:
davidserrano.io/
/ svprdga
hashnode.com/@svprdga
dev.to/svprdga
mastodon.social/@svprdga
⏳ 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

Наука

Опубликовано:

 

13 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 2   
@piffyization
@piffyization Год назад
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 Год назад
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
Далее
Dart Basics - var, final, const and dynamic key words
11:44
ПАПА ГАМБУРГЕР
00:13
Просмотров 154 тыс.
Почему худеют от Оземпик?
00:37
Просмотров 263 тыс.
Rust Data Modelling Without Classes
11:25
Просмотров 165 тыс.
Stateless vs Stateful | Flutter Example
6:45
Просмотров 17 тыс.
👨🏽‍💻 Dart Null Safety (Simple)
14:24
Просмотров 11 тыс.
Dart const, final and immutability
9:59
Просмотров 1,6 тыс.
Top 30 Flutter Tips and Tricks
6:50
Просмотров 540 тыс.
Var vs. Dynamic & Const vs. Final in Dart
6:06
Simulating the Evolution of Rock, Paper, Scissors
15:00
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Просмотров 1,6 млн