some preference improvements
Some checks failed
Build and release APK / Build APK (pull_request) Successful in 7m27s
Test code / Test code (push) Has been cancelled
Build web / Build Web (pull_request) Has been cancelled
Test code / Test code (pull_request) Has been cancelled

This commit is contained in:
2024-05-25 18:55:58 +02:00
parent 07830de1b2
commit 3029fb8537
13 changed files with 365 additions and 56 deletions

View File

@@ -0,0 +1,18 @@
import "package:fast_network_navigation/structs/destination.dart";
import 'package:http/http.dart' as http;
import 'dart:convert';
Future<Destination> fetchDestination() async {
final response = await http
.get(Uri.parse('https://nav.kluster.moll.re/v1/destination/1'));
if (response.statusCode == 200) {
// If the server did return a 200 OK response,
// then parse the JSON.
return Destination.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
} else {
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load destination');
}
}