mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-29 06:26:02 +00:00
Typo
This commit is contained in:
parent
5239c12484
commit
57a6f141fd
2 changed files with 21 additions and 2 deletions
19
aidedejeu_flutter/lib/test.dart
Normal file
19
aidedejeu_flutter/lib/test.dart
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class MyWebApi {
|
||||
final _baseUrl = "dummy.test.org";
|
||||
|
||||
Future<MyResponse> fetchData(
|
||||
String id) async {
|
||||
String apiPath = "/my_path/" + id;
|
||||
final response = await http.get(Uri.https(_baseUrl, apiPath));
|
||||
if (response.statusCode == 200) {
|
||||
print(response.body);
|
||||
return MyResponse.fromJson(json.decode(response.body));
|
||||
} else {
|
||||
throw Exception('Failed to load data');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue