public async Task <ProductSingle> GetProducto(string code) { string json = string.Empty; HttpClient client = new HttpClient(); string url = string.Format("{0}{1}.json", $"https://angurlar-html-default-rtdb.firebaseio.com/productos/", code); HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); ProductSingle result = Newtonsoft.Json.JsonConvert.DeserializeObject <ProductSingle>(responseBody); return(result); }
protected async override Task OnInitializedAsync() { producto = await GetProducto(cod); }