Get property from resource in collection

Hi guys. I am learning cadence by tutorial. I have some misunderstanding in the 4th part (Non-Fungible Tokens). I want to add some extra information in NFT resource. I add some property “meta” in this resource and I created func to get this property (“return self.ownedNFTs[i].meta”), but I face with error “value of type ExampleNFT.NFT? has no member meta. unknown member”. The same for id. How can I grant access to see variable in resource? The link to this tutorial: Flow Playground. The contract // NFTv2.cdc in the second account.

Your type here is an optional, so you need to unwrap it before accessing the field. See my blog post for more information about optionals: Optionals in Cadence? Not Optional! | by Joshua Hannan | Apr, 2021 | Medium