All language subtitles for 20. Anonymous Functionsf

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,400 --> 00:00:07,970 Now this way of hooking up a button to a function is one of two possible ways. 2 00:00:08,070 --> 00:00:11,760 We have our function here, our named function inside of stateless widget 3 00:00:12,360 --> 00:00:15,490 and then we connect here to onPressed. 4 00:00:15,720 --> 00:00:20,040 Now another way of solving this would be to use an anonymous function, 5 00:00:20,040 --> 00:00:22,830 this here is a named function because it has a name. 6 00:00:22,860 --> 00:00:27,750 Now if you have a function which you really only need here in this one place and you're never calling 7 00:00:27,750 --> 00:00:32,760 it from anywhere else in the application which is already not the case here because we have three buttons 8 00:00:32,760 --> 00:00:33,720 that use the function 9 00:00:33,720 --> 00:00:39,810 but let's say you only had one button, then instead of using a named function which you can always do 10 00:00:39,850 --> 00:00:46,770 but instead of doing that, you can add a function right here. Now without a name but you simply add parentheses 11 00:00:47,010 --> 00:00:50,450 to get any possible arguments, in this case you don't get any though, 12 00:00:50,460 --> 00:00:56,870 so it's an empty pair of parentheses and then either that one line expressions syntax with an arrow function 13 00:00:57,300 --> 00:00:58,890 and then the code you want to execute, 14 00:00:58,890 --> 00:01:03,780 so here answer 2 chosen for example or if I do the same on answer 3, 15 00:01:03,840 --> 00:01:09,930 you can also add curly braces for a possibly longer function body. 16 00:01:09,930 --> 00:01:18,130 So here, you could now do some stuff and then in the end, print answer 3 chosen, like this 17 00:01:21,940 --> 00:01:24,330 and here I had one parentheses too much. 18 00:01:24,330 --> 00:01:32,110 Now if I save that, you will see that if I click answer 1, 2, 3 here, we see answer chosen, 19 00:01:32,130 --> 00:01:35,600 that's from the answer 1 button which executed our name, 20 00:01:35,610 --> 00:01:42,240 answerQuestion function, then we had answer 2 chosen which is coming from my anonymous function here 21 00:01:42,620 --> 00:01:45,740 and answer 3 chosen which is coming from the function here 22 00:01:45,870 --> 00:01:48,700 and it's called anonymous because it has no name here, 23 00:01:48,720 --> 00:01:52,400 it just has the argument list and then the function body. 24 00:01:52,560 --> 00:01:57,030 Now an anonymous function always is a good idea if you never need to call it from anywhere else in the 25 00:01:57,030 --> 00:02:00,530 code because you can't call it from anywhere else, it has no name 26 00:02:00,780 --> 00:02:03,660 but you don't need to define it up here 27 00:02:03,660 --> 00:02:06,020 if you only need it in one place. 28 00:02:06,060 --> 00:02:10,710 So these are two function syntaxes which you will also see throughout the course, please note that this 29 00:02:10,710 --> 00:02:13,050 also is not executed immediately, 30 00:02:13,050 --> 00:02:15,050 this is just the function definition, 31 00:02:15,090 --> 00:02:19,320 I didn't add parentheses after that which would execute it immediately, 32 00:02:19,320 --> 00:02:25,740 instead I just defined my function here with the arguments in the function body and I pass that definition 33 00:02:25,980 --> 00:02:31,770 of the function to onPressed, which therefore ensures that the RaisedButton can execute the function when 34 00:02:31,770 --> 00:02:39,110 the user really pressed the button. So that's a lot of fun with buttons and functions and it's a crucial 35 00:02:39,110 --> 00:02:45,110 building block of Flutter applications because in your typical application of course, you do interact 36 00:02:45,110 --> 00:02:49,940 with the user and you want to give the user some chance of interacting with the application 37 00:02:49,970 --> 00:02:54,140 and that requires exactly what we learned here. 38 00:02:54,140 --> 00:02:57,790 Nonetheless right now, we're really just doing some behind the scenes stuff right, 39 00:02:57,800 --> 00:03:03,560 we're really just printing something here and that's nice for debugging so that we see that the buttons 40 00:03:03,560 --> 00:03:09,410 really are pressed but it would be nicer to change something on the screen before we then also later 41 00:03:09,410 --> 00:03:14,510 work on the general layout and the look of this and that is exactly what we'll do next. 42 00:03:14,510 --> 00:03:18,260 Let's make sure that something changes on the screen when we press one of these buttons. 4768

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.