All language subtitles for 006 Function References_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian Download
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,910 --> 00:00:05,350 In the last section, we added in an image middle class to our project, we're now ready to make an 2 00:00:05,350 --> 00:00:11,640 HTTP request over to that API, get our JSON data, and then create a new instance of an image model. 3 00:00:12,370 --> 00:00:16,290 So to actually make the request, I'm going to flip back over to my app dart file. 4 00:00:16,990 --> 00:00:22,420 So we probably want to make the request only when a user presses on that floating action button. 5 00:00:22,630 --> 00:00:23,610 That makes sense, right? 6 00:00:24,040 --> 00:00:25,640 When a user presses on that button. 7 00:00:25,690 --> 00:00:32,920 That means it's now time to fetch one additional image from that Jason API, get back that JSON pass 8 00:00:32,920 --> 00:00:33,190 it. 9 00:00:33,220 --> 00:00:36,900 We get the image model and then we'll try to create a widget to show that thing on the screen. 10 00:00:37,510 --> 00:00:42,370 So essentially inside of this unpressed callback right here is where we're going to want to fetch our 11 00:00:42,370 --> 00:00:42,710 data. 12 00:00:43,510 --> 00:00:49,420 Now, at this point, putting in a ton of logic into this function right here, it seems like we might 13 00:00:49,420 --> 00:00:55,690 be putting in too much logic into this like, very confusing blob of code right here. 14 00:00:56,240 --> 00:01:00,670 So rather than continuing to add on more code to this function, I think that we're going to create 15 00:01:00,670 --> 00:01:04,870 a separate method on our app state widget right here. 16 00:01:05,800 --> 00:01:11,440 And inside of that new method is where we'll put all the logic to fetch our data, do all this stuff 17 00:01:11,440 --> 00:01:12,160 that we need to do. 18 00:01:13,250 --> 00:01:21,380 So above my build method, I'm going to add on one additional method that I will call fetch image like 19 00:01:21,390 --> 00:01:25,680 so I don't think Fetch Image is going to need to return any data. 20 00:01:25,700 --> 00:01:27,320 I think that we just need to call it. 21 00:01:27,530 --> 00:01:32,040 And I think this method should attempt to make the request and do whatever is appropriate. 22 00:01:32,420 --> 00:01:36,680 So in other words, I'm going to market with a void type for the return type. 23 00:01:38,040 --> 00:01:44,910 So now inside of on prest right here, rather than calling set state and rather than incrementing the 24 00:01:44,910 --> 00:01:48,000 counter right here, I'm going to delete all that stuff. 25 00:01:50,250 --> 00:01:52,950 And I will instead call fetch image. 26 00:01:54,470 --> 00:02:00,950 Now, what we have right here is a function that simply calls another function, because we have a function 27 00:02:00,950 --> 00:02:04,720 that calls another function, we don't really have to write out the outer function. 28 00:02:05,030 --> 00:02:09,470 We can instead just provide a reference to the fetch image method. 29 00:02:09,830 --> 00:02:15,530 So we'll just say, hey, unpressed whenever you get called or whenever we need to call a callback function 30 00:02:15,530 --> 00:02:16,820 because the button was just pressed. 31 00:02:17,060 --> 00:02:19,550 Here's a reference to a function that we want you to call. 32 00:02:20,180 --> 00:02:25,040 So rather than writing out the outer function and the inner one, we can condense this. 33 00:02:25,190 --> 00:02:27,020 So I'm going to delete that entire function right there. 34 00:02:28,490 --> 00:02:31,370 And I can write out simply fetch image. 35 00:02:32,260 --> 00:02:32,830 Like so. 36 00:02:34,060 --> 00:02:40,120 Now, you'll notice that I do not have any parentheses on here, no parentheses, if I put parentheses 37 00:02:40,120 --> 00:02:45,430 on, then that means that the instant the build method is called the fetched image method will be invoked. 38 00:02:45,430 --> 00:02:46,990 And that's definitely not what we want. 39 00:02:47,710 --> 00:02:49,540 So I'm going to take those parentheses off. 40 00:02:50,020 --> 00:02:55,450 And now we are giving a reference to the fetch image function to this on prest property. 41 00:02:55,840 --> 00:03:00,370 So any time the button gets pressed the button, it knows, oh yeah, I've got a reference or I got 42 00:03:00,370 --> 00:03:03,130 a handle on the fetch image method that I need to call. 43 00:03:04,300 --> 00:03:10,180 So now we can write all of our logic to go and attempt to fetch an image inside of the fetch image method 44 00:03:10,180 --> 00:03:10,630 right here. 45 00:03:11,520 --> 00:03:11,850 Call. 46 00:03:13,440 --> 00:03:20,040 OK, so I'm going to save this, and now we need to somehow make our request, so that's the core of 47 00:03:20,040 --> 00:03:20,800 what we're doing right here. 48 00:03:20,820 --> 00:03:22,770 That's what we really want to do inside of each image. 49 00:03:23,070 --> 00:03:27,420 We need to make an HTTP request over to that JSON endpoints. 50 00:03:27,930 --> 00:03:29,700 So this URL right here. 51 00:03:29,880 --> 00:03:36,180 So we want to go to Type II COCOM photos, the idea of the image we want to get. 52 00:03:37,100 --> 00:03:40,640 So let's take a quick pause right now, we'll come back to the next section and start writing out that 53 00:03:40,640 --> 00:03:41,000 code. 5326

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