All language subtitles for 012 Annotating Argument Types_en

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
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 Download
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:00,760 --> 00:00:06,010 In the last section, we took care of our shuffle function by relying upon some functionality that was 2 00:00:06,010 --> 00:00:07,910 implemented in the standard library. 3 00:00:08,410 --> 00:00:11,810 We're not going to move on to our next function, which is cards with suits. 4 00:00:12,400 --> 00:00:16,300 Let's take a look at a diagram that's going to give you a better idea of the purpose of this function. 5 00:00:17,050 --> 00:00:21,570 So I want you to imagine for a second that maybe we have this deck of cards shown at the top. 6 00:00:21,940 --> 00:00:26,470 So ace of diamonds, two, three, and then ace of spades and two of spades. 7 00:00:27,310 --> 00:00:34,450 If we call the cards with method on the deck class in passing a string of spades, then I would expect 8 00:00:34,450 --> 00:00:40,110 to receive a list back to me with the ace of spades and the two of spades. 9 00:00:40,480 --> 00:00:44,650 So essentially go through the deck and find all the cards with a particular suit. 10 00:00:45,370 --> 00:00:50,800 Now, one thing I want to mention here is that we do not want to modify the original deck of cards, 11 00:00:51,070 --> 00:00:53,230 so we're not trying to pull cards out of here. 12 00:00:53,380 --> 00:00:59,260 I just want to get a list telling me all the cards with a particular suit that still exist inside the 13 00:00:59,260 --> 00:00:59,590 deck. 14 00:01:00,960 --> 00:01:04,410 OK, so let's go back over to Arpad Pad and we're going to start our implementation. 15 00:01:05,250 --> 00:01:11,910 So back over here, I'll find my deck class, I'm going to add a new method to this class down at the 16 00:01:11,910 --> 00:01:13,650 very bottom of the class itself. 17 00:01:14,670 --> 00:01:17,940 And I'm going to call this cards with suit. 18 00:01:18,920 --> 00:01:24,980 Now, as we just saw in that diagram two seconds ago, right over here, we clearly have to pass in 19 00:01:24,980 --> 00:01:28,070 a string that indicates what suit we're trying to find. 20 00:01:28,470 --> 00:01:34,370 So I'm going to make sure that I marked this method as requiring one argument that we will refer to 21 00:01:34,370 --> 00:01:35,630 as simply suit. 22 00:01:36,620 --> 00:01:41,960 So now, if you want to call the cards with suit method, you have to pass in some suit arguments. 23 00:01:42,740 --> 00:01:47,510 One thing I want to mention here is that if you click on a suit and then look down at the type on the 24 00:01:47,510 --> 00:01:50,480 bottom right hand side, it says dynamic suit. 25 00:01:51,020 --> 00:01:57,110 The word dynamic here means that Dart is not able to figure out what type of variable suit is supposed 26 00:01:57,110 --> 00:01:57,500 to be. 27 00:01:58,340 --> 00:02:02,690 So this is a good example of where Dart's going to try to figure out what's going on with your code, 28 00:02:02,690 --> 00:02:05,480 but it's not quite able to any time. 29 00:02:05,480 --> 00:02:09,380 Dart does not have enough information to figure out what your code is trying to do. 30 00:02:09,560 --> 00:02:12,890 I recommend annotating your values with a type. 31 00:02:13,400 --> 00:02:16,390 We've already done this a couple of times inside of our project already. 32 00:02:16,730 --> 00:02:19,160 You'll notice that, say, on the card class right here. 33 00:02:19,190 --> 00:02:25,310 We specifically marked this suit as being type string and that gave Dart enough information to figure 34 00:02:25,310 --> 00:02:27,560 out what type the suit property was supposed to be. 35 00:02:29,150 --> 00:02:34,970 But in this case, we don't have enough information, and so I'm going to specifically mark this argument 36 00:02:35,210 --> 00:02:38,840 as simple as requiring to be of type string. 37 00:02:38,870 --> 00:02:45,080 So I want to make sure that if you ever call this cards with such argument, you pass in a single argument 38 00:02:45,080 --> 00:02:46,070 that is a string. 39 00:02:46,430 --> 00:02:47,240 So to do so. 40 00:02:47,240 --> 00:02:47,690 All right. 41 00:02:47,690 --> 00:02:50,240 Out string and then suit. 42 00:02:51,110 --> 00:02:54,950 So now if I click on it again, you'll notice that it says string suit. 43 00:02:54,980 --> 00:03:00,380 So we've now given darte enough information to figure out what type of variable suit is right here. 44 00:03:01,480 --> 00:03:07,330 OK, so now that we are inside of our cards with suit method and we have the appropriate type of argument, 45 00:03:07,600 --> 00:03:13,570 we can now write some logic to go into our list of cards and find every card with a given suit. 46 00:03:14,260 --> 00:03:18,370 Now, you might be thinking that we're going to have to put together a for loop or something crazy like 47 00:03:18,370 --> 00:03:21,790 that and iterate over all the cards within our deck. 48 00:03:23,510 --> 00:03:29,180 But rather than doing that, we're going to, again, rely upon the standard library, particularly 49 00:03:29,180 --> 00:03:32,150 some functionality that we get with every list for free. 50 00:03:32,870 --> 00:03:36,110 So I'm going to, again, pull up the list documentation. 51 00:03:37,010 --> 00:03:44,300 Remember, you can get here by going to API, darling Doug, and then you'll look for the dart core 52 00:03:44,300 --> 00:03:45,290 module right here. 53 00:03:46,330 --> 00:03:49,600 And then you can find the list section on the right hand side. 54 00:03:51,390 --> 00:03:55,380 So once I'm back here, I'm going to scroll down towards the very bottom of the file. 55 00:03:56,490 --> 00:04:01,890 So all the way down here, right above the operators section, I'll find a method called where? 56 00:04:04,180 --> 00:04:09,850 So the we're method right here is going to return a new lazy iterable, let's don't worry about what 57 00:04:09,850 --> 00:04:11,850 a lazy iterable is just yet. 58 00:04:11,860 --> 00:04:14,110 It's essentially kind of something like a list. 59 00:04:14,440 --> 00:04:20,350 But more importantly, it says that it's going to return an iterable with all the elements that satisfy 60 00:04:20,350 --> 00:04:21,640 some given test. 61 00:04:22,340 --> 00:04:27,310 So we're going to make use of this where method right here to automatically iterate through all the 62 00:04:27,550 --> 00:04:34,120 items within our carts list and only return the items that satisfy some test that you and I are going 63 00:04:34,120 --> 00:04:34,590 to write. 64 00:04:35,320 --> 00:04:36,450 So let's take a pause right here. 65 00:04:36,460 --> 00:04:40,810 We're going to come back the next section and we're going to start our implementation of this where 66 00:04:40,810 --> 00:04:41,230 method. 6741

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