Dart Defining Constants using 'final' and 'const' keyword. Dart Tutorial for Flutter #3.3

Dart Defining Constants using 'final' and 'const' keyword. Dart Tutorial for Flutter #3.3

Smartherd

5 лет назад

97,830 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@allancabilestoc6235
@allancabilestoc6235 - 22.11.2023 11:52

Clear explanation.. Thank you

Ответить
@k-5773
@k-5773 - 21.06.2023 21:09

Why can’t instance variable be const, why static const?

Ответить
@game-yx4ps
@game-yx4ps - 25.03.2023 13:55

Thank you very much it help me a lot

Ответить
@shahabedinmohamadi9368
@shahabedinmohamadi9368 - 14.02.2023 15:30

Which video in your playlist is about static?

Ответить
@kmqwewq
@kmqwewq - 17.11.2022 08:02

You use final instead of const if you don't have an initilal value at compiletime.
for example if you have a user input for a variable which should be never changed after, this you cannot do with const.

import 'dart:io';

void main() {
final name; // we don't have a value yet
stdout.write("Enter your name : ");
name = stdin.readLineSync(); // this initializes the variable and convert it to a "constant"
stdout.write('your name is: ${name}\n');
}


in my opionion is this the main usage of final

Ответить
@devashishthakkar6723
@devashishthakkar6723 - 10.10.2022 08:52

Aumsum sir!

Ответить
@someshsahu4638
@someshsahu4638 - 19.08.2022 14:47

Nice video thankyou 🙏🏼

Ответить
@lahirudx
@lahirudx - 30.06.2021 21:27

Finally found a better explanation for const and final.

Ответить
@ctky478
@ctky478 - 12.03.2021 14:02

Also if you not sure what values to use after compile time, you use final as these values can be determined during runtime.

Ответить
@Sureshkumar-qi9wg
@Sureshkumar-qi9wg - 18.02.2021 15:40

very very good bro tq very much from india

Ответить
@SamarpanDasguptaOfficial
@SamarpanDasguptaOfficial - 30.01.2021 15:44

Nice tutorial for dart...I love it

Ответить
@raousama6232
@raousama6232 - 16.12.2020 21:08

i am having this problem.whenever i declare string name it show no error after that when i declare string message online compiler underline message and says The value of the local variable 'message' isn't used - line 3

Ответить
@labibkhanofficialbd
@labibkhanofficialbd - 25.11.2020 16:34

Please use Subtitle CC

Ответить
@sanjogbelose943
@sanjogbelose943 - 19.08.2020 08:14

Thank u so much, u were very helpful !!

Ответить
@JustForFun-lz5db
@JustForFun-lz5db - 03.08.2020 19:00

Diff between final and const. You made it clear. Thank you !

Ответить
@leandroacevedo3339
@leandroacevedo3339 - 26.06.2020 01:59

You explain very well, my friend. I understand you more than the courses I've seen in my native language. Keep it up! you earned my like and subscription.

Ответить
@SachinYadav-wn3fm
@SachinYadav-wn3fm - 10.05.2020 19:35

in my compailer the when i write string S1="double"; is not working on string , so i just put var in place of string then is it work . howwwww??????

Ответить
@saisasisai
@saisasisai - 06.04.2020 07:47

Nice 👌 Tutorial series ...!

Ответить
@shahruliman5544
@shahruliman5544 - 10.12.2019 09:25

👍👍👍

Ответить
@webemerson101
@webemerson101 - 05.12.2019 08:15

I can't wait to finish this awesome course, cheers men your good at explaining stuff straight to the point. I love it <3

Ответить
@nasirmehmood_
@nasirmehmood_ - 28.11.2019 03:44

perfect

Ответить
@hicnar
@hicnar - 07.11.2019 22:50

Well, you explained how the 'final' keyword works in a way the keyword 'lazy' works in Scala. Just tested that and if you declare a final variable in Dart and initialize it with values that is returned by a call to a function. Dart seem to call the function anyway (see the snippet below) whereas Scala calls the function only if a lazy variable is actually accessed. So is there any other difference?


String toUpper(String name) {
print("toUpper called with name: $name");
return name.toUpperCase();
}

void main() {
final name = toUpper("peter");
//this will actually print out "toUpper called with name: peter"

}

Ответить
@qwerasdfhjkio
@qwerasdfhjkio - 14.10.2019 19:47

I still don't understand the difference :(((

Ответить
@karthickrajalearn
@karthickrajalearn - 08.09.2019 14:59

In 1m 2sec
Great Tip
Difference between final and const keyword

Thanks for Explaining Dart Programming Easily 👍👍👍👌👌👌

Ответить
@dhameliyadevang4771
@dhameliyadevang4771 - 12.08.2019 03:35

Hey mate.. first of all, thanks for this wonderful series of dart.

Ответить
@adonisrn
@adonisrn - 02.08.2019 07:31

Nice explanation about final and const.

Ответить
@amircodes
@amircodes - 17.07.2019 23:20

Thanks for excellent explanation.

Ответить
@BewkoofCompany
@BewkoofCompany - 15.07.2019 21:42

shocked when he said Mumbai ❤️❤️

Ответить
@anaskhaani
@anaskhaani - 27.06.2019 21:30

beautiful explained sir

Ответить
@tdothot1
@tdothot1 - 23.06.2019 02:55

The best explanation of the differences between const and final in dart. GOOD JOB!!!

Ответить
@viralvideos9227
@viralvideos9227 - 06.06.2019 20:15

is const is method or class?

Ответить
@maniamadrid
@maniamadrid - 29.05.2019 05:57

very good explanation and easy to understand.

Ответить
@ratanupadhyay9497
@ratanupadhyay9497 - 09.04.2019 21:07

Awesome sir..Really need of ppls like u

Ответить
@tanzilzubairbinzaman8711
@tanzilzubairbinzaman8711 - 06.03.2019 18:33

Sir, what do you mean memory will be allocated? What does this mean?

Ответить
@krishnakumarramachandran5888
@krishnakumarramachandran5888 - 06.11.2018 18:22

I'm daily watching your dart tutorial video sir. Good to learn dart with your video.

Ответить
@karimovitche
@karimovitche - 28.09.2018 23:39

Great work.

Ответить
@TheKailash111
@TheKailash111 - 06.08.2018 21:25

how to get integer or string from user, like enter the number and display it...

Ответить
@eugen3775
@eugen3775 - 04.08.2018 22:03

This channel deserves more views, I have seen so called "pros" not being able to properly explain string interpolation in Dart. Good job man. Subscribed.

Ответить