skip to Main Content

Visual Studio Code – C# MAUI Async function catches for Windows but not for Android

I have the following code: public partial class MetricsPage : ContentPage { public MetricsPage() { InitializeComponent(); using var client = new HttpClient(); client.BaseAddress = new Uri("http://example.com"); client.Timeout = new TimeSpan(0, 0, 3); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Api-Key", "<my_key>"); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json"));…

VIEW QUESTION

Flutter FutureBuilder stuck at ConnectionState.waiting

I'm new and currently learning Flutter, I have a question about FutureBuilder. My code is stuck at ConnectionState.waiting and I'm not sure why. My codes are import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; class DartPad extends StatefulWidget { const…

VIEW QUESTION

How to properly use unawaited in dart? – Flutter

import 'dart:async'; import 'dart:convert'; import 'package:http/http.dart' as http; void main() async { print('start api'); for (var i = 1; i < 4; i++) { print(unawaited(fetchApi(i))); } print('end api'); } Future<String> fetchApi(int idNum) async { final url = Uri.parse('https://jsonplaceholder.typicode.com/albums/$idNum'); final response…

VIEW QUESTION
Back To Top
Search