Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the last section, we imported just the jet function into our Abdah Dart file.
So now we're ready to use that jet function to make a request over to that JSON API endpoint inside
of my FETs image method right here.
I'm going to call get the first argument to the jet function is the URL that we want to make a request
to.
To get that Yoro, I'm going to go back over to my browser where I still have the JSON placeholder type
I code dot com you URL inside of my address bar.
So I'm going to copy this.
You are all right here.
And then I will put it in as the first argument to my get function as a string like so.
Now, if we make a request to photos that's going to retrieve all five thousand photos that are posted
at the CPI and that's definitely not what we want to do.
We only want to get one specific photo at a time.
So to indicate which photo we want, I'm going to put a slash at the very end.
Oops, slash at the very end.
There we go.
And then we'll write out the ID of the photo that we want to fetch.
So chances are that we want to start with the ID of one, because that's the first photo there is inside
this collection.
And then get photo two, three, four, five and so on.
So for that, we can reuse the counter variable that we had previously created.
Remember, we start off counter as zero and then every time a user presses the button, we will increment
that counter variable by one.
So I'm going to use a little bit of string interpolation here and I'll put on counter at the very end.
But you'll notice that any time that counter is initialized inside of our asset class, it starts off
as zero and there is no photo with ID of zero.
If we go back to that photos endpoint, the first photo inside the collection has an idea of one.
So I'm going to make sure that I don't try to get a photo with idea of zero by just incrementing the
counter variable by one right before we make that request.
So we can absolutely increment countered by one by using the syntax right here.
We could also write out simply counter plus plus, which has the same effect, counter plus plus will
increment the counter variable by one.
OK, so that looks pretty good now before we try to test out anything here.
There's one thing I want to remind you about that I very briefly pointed out in the last section, if
we go back over to the documentation for our dysfunction, here is the jet function we pass in the URL
as the first argument.
You'll remember that I mentioned that the jet function returns something called a future.
So we need to have a quick discussion about what a future is, because it's a very important concept
that's going to come up many, many times throughout all the other applications that we're going to
build in this course.
So we'll take a quick break, come back the next section and talk about what a future is.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.