Hello, if I run a http request on the web I alway get a xmlhttprequest error, does anybody know how to fix that issue?
code:
TypeScript
Future<bool> checkName(String name) async {
const apiUrl = 'https://...';
try {
final response = await http.get(Uri.parse(apiUrl));
if (response.statusCode == 200) {
final Map<String, dynamic> data = json.decode(response.body);
// Überprüfe, ob 'names' in den Daten vorhanden ist
if (data.containsKey('names')) {
return data['names'].contains(name);
} else {
throw Exception('Ungültiges Format der API-Antwort: \'names\' nicht gefunden.');
}
} else {
throw Exception('Fehler bei der API-Anfrage: ${response.statusCode}');
}
} catch (e) {
print('Fehler: $e');
return false;
}
}```
I know that I am here on the appwrite discord, but I could find help on the internet and other servers.
TL;DR
Developers are experiencing an xmlhttprequest error in Flutter's HTTP package. There is a suggestion to use the SDK for Flutter to handle sessions. One developer is facing an issue with a http request on the web. A code snippet for a function called 'checkName' is provided, where the error occurs.
Solution: The developer can try using Flutter's SDK for better session handling.You're doing requests with the API?
I suggest using the SDK for flutter since it will handle sessions, etc.
Anyways, what are the requests that you're performing?
Recommended threads
- [SOLVED] Appwrite Cloud and FRA cloud se...
Can anyone estimate how long this will take to resolve? I am checking status here https://status.appwrite.online/
- How to use Operator.arrayAppend on a rel...
Hi, is it possible to use any operator on a relationship column? I have a One to Many relationship column on a table and I would like to add entries to the colu...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...