Afrikaans
Akan
Albanian
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Esperanto
Estonian
Ewe
Faroese
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hmong
Hungarian
Icelandic
Igbo
Interlingua
Irish
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
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
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the last section, we spoke about how we need to create a global key and somehow reference it or
get it to reference our form state that is created and each time we create a form widget, again, I
know this stuff is kind of heavy duty, kind of complicated, but as soon as we start writing some code,
I think you'll start to get an idea of what's going on.
So let's write some code.
I'm going to begin by looking back over to my code editor and I'm going to find my login screen state
class.
So inside, if you're going to create a new instance variable that's going to store that global key.
So I'm going to make a final variable which remembers just means I cannot reassign this variable.
I'm going to call it form key because it's referencing the form into it, I'm going to assign global
key and then this thing uses that same generic syntax that we use for state up here.
Remember, these generic open closing little brackets are a way to kind of create a constructor or a
class that accepts a type almost like a function.
So we put a type inside of here and that customizes how all the functions inside of it behave, or at
least what different types they expect.
So to the global key, we do not want to reference the form class, we want to reference a class called
Form State.
So for the type here, I'm going to put in form state like so, and then I'm going to put myself in
parentheses to indicate that I want to create an instance of this global key thing.
OK, so this right here is just about the only place we're going to see this form state thing come into
play.
That's why I had to tell you about the existence of this form state, because at some point we had to,
like, write out Farm State right here.
If we just wrote form state, you probably would have been like, Stephen, why are we writing for state
and not just farm?
OK, so this creates the key.
Now, step two is to take this key and associated with the form widget that we are creating.
So on my form widget as an additional named property, I'm going to pass in key and key is going to
be the form key instance variable that we just created.
So I'm going to say form key like so.
And that's pretty much it.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.