Difference Between final and const Keywords in Dart | Dart Tutorial for Flutter in Hindi | #13
HTML-код
- Опубликовано: 19 окт 2024
- The final and const keywords are similar in that they are used to declare variables whose value cannot be changed after they are initialized. However, there are some key differences between the two keywords:
final: The final keyword is used to declare a variable whose value cannot be changed after it is initialized. The value of a final variable is determined at runtime. This means that the value of a final variable can be different for different objects, but once it is set, it cannot be changed.
const: The const keyword is similar to final, but the value of a const variable is determined at compile time. This means that the value of a const variable is the same for all objects, and it cannot be changed.
Here are a few key differences between final and const:
Scope: final variables are only accessible within the scope they are declared in, while const variables are accessible throughout the entire app.
Performance: const variables are evaluated at compile time, which means they are faster at runtime than final variables.
Modification: final variables can be modified within a constructor, while const variables cannot be modified at all.
My RUclips Gear:
Boya BYM1(Mic): amzn.to/3bvm69j
Redmi Note 7 Pro(Mic & Camera): amzn.to/3uRkVsb
MSI Motherboard: amzn.to/3fiQHYO
Intel i3 Processor: amzn.to/3w8TWbQ
Mouse: amzn.to/3yb8PMP
Keyboard: amzn.to/3bvmtkd
Wifi Adaptor: amzn.to/3fiQYuO
SSD: amzn.to/3w2w2Pa
Speakers: amzn.to/3w6pKhv
----------------------------------
Dart final and const keyword | Tutorial for Flutter | #12
• Final and Const Keywor...
Difference Between var and dynamic Keywords in Dart | #11
• Difference Between var...
Dart Dynamic keyword | Hindi | #10
• Dynamic keyword in Dar...
Dart var Keyword | Hindi | #9
• Var Keyword in Dart | ...
Dart String and String Interpolation | #8
• Strings and String Int...
----------------------------------
Instagram: / ahirlog
Facebook: / ahirlog
Twitter: / ahirlog
RUclips: / ahirlog
#ahirlog #flutter #dart
Last Summer by Ikson: / ikson
Music promoted by Audio Library • Last Summer - Ikson (N...
Wonderfully explained!!
very nicely explained man. You deserve more subscribers
Support
sir are you talking about declare or initialize
awesome bro Keep it up!
Thanks bro
THANKS
BHAI
LOVE
U
BHAI
AP
AI
DART
VIDEO
BANATY
RAHO
welcome bhai
What about Object ? if we declared variable final and const with object ?
Try to use subtitles to reach a large audience
good explanation
Thanks ☺️
Thank you
Thanks 👍
I don't understand Const .
It's declares that you know but don't have teaching capabilities.
Exactly