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
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
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
Russian
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
Now let's start with the ternary expression and therefore here, you first of all have your condition.
The condition here could be without the if keyword,
that's how you'll write a ternary expression.
So the condition here can be the same condition as up there,
is the question index smaller than the question length? If this is the case, then you add a question mark,
this will then mark the border to the code which should run if this is true.
So the thing after the question mark is used
if this condition is true and then you need to add a colon after the code block that should be used
if this is true
and this part after the question mark must only be one expression, here since it's a lot of lines, it
looks like it's more than one expression but in the end, it's only the column here,
right?
It's only the column, all the other stuff is in the column.
So only the column here is created
if that is true and therefore after the column down there, we add a colon
and now we have the so-called else block.
We didn't have an else block up there but we could add it here as well,
you can add else here and then you can define code that should run if the condition is not met,
so if this here, if this returns false, then you will go into the else block. By the way in if statements
like this here,
you can also have else if statements where you could add other conditions which are checked if the first
condition is not met but let's ignore that for now. For the ternary expression here down in our body,
we don't have else if but we do have our main code,
if the condition is met and then after the colon, we have our else block
and now that could be a center widget which is another widget baked into Flutter that centers all
the content horizontally and vertically on the page.
It takes a child and that is then the widget which should be centered
and this could simply be some text like you did it and let's add a trailing comma here, reformat everything
and now we have a ternary expression. If we now reload this application and we go back,
now I can select my answers but after the third button click, we don't get the error but we get
you did it
and that's of course way nicer and already a better user experience.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.