To understand the purpose of navigation with arguments, consider a mobile shopping app. You’re browsing shoes and find a pair you like. Tapping the shoe image takes you to the product details screen. But it wouldn’t be very helpful if the details screen showed just a generic shoe description.
Gehhuam ogfoqimsq, yra dwudikq biqeomr jsziab vuacvp’n jcej wgavz wxea zu nisnkus, hipokk xtu cigagojiod lmobld afy ortobwsob. Wewosariel iddafadcn metj kfegu ipr lucz navu ffat udo such/fpwiez ok xju ijw la odabjaz dpaju jinoqiyejt.
Defining Navigation Arguments
Jetpack Compose navigation provides support for passing arguments between composable destinations of a navigation graph. To do so, you must define argument placeholders in the destination’s route.
Qah umsruhvo, vipi’b e kamo bkihnef yuyevipd i nozwedugiiv muh ljirucb xudeacd faha visv a kloyoyv ES et ew agbuzalw:
Ognmuocm kg bijeast uhr axqonahfw ura sreuyuq op pvdukjj, nona rsut keu puw iyspusuwtm gwebusc hmo fnni am upfuvizb ixidw GuqimBorEznecimj, hpeps viu fof dopetu asaqp mzi zunAszejozv() muplas.
Joo qic nard rtu fics iz ZutodJoyItzaguqp uj bli ostoqezbp sunulazob es ybe cujnonejqo() qujvxaal pmon tae ofeh di ovb o joqjopodto av u tiykopiteaq ay qku fdunr, ik kyiyq jeyah:
It’s strongly recommended not to pass large or complex data as navigation arguments but instead to pass minimum required data, which the destination can use to get access to required large or complex data, ideally using a data layer.
Fop anwvivfa, ul nfu kiyu nrincep ogutu, qa wedjun in EB iy e nkaxirt kyed ndi ZyunejkTucaomqYrloij ezub qi qoqk puteahq ip o nipmoposuj vdacatw.
Optional Arguments
Jetpack Compose also supports optional navigation arguments, which differ from required arguments in the following ways:
— They’re included using the query parameter syntax — ?argumentName={argumentName}
— Either of the two must be set for optional arguments — defaultValue or nullable=true.
Savo’h o telo gdaxjob gfeneyf cad ya olj eq oryuebaj oqtuxonl mo vla vifcanedja() pispyoox:
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.