decode utf8

This commit is contained in:
Valentin CZERYBA 2024-06-23 15:11:35 +02:00
parent dac570fffc
commit 943895accb
2 changed files with 5 additions and 5 deletions

View File

@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@ -66,17 +66,17 @@ class _MyHomePageState extends State<MyHomePage> with ShowErrorDialog {
String former = ""; String former = "";
if (accessToken.isNotEmpty) { if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("http://${globals.api}/users"); var urlGet = Uri.parse("http://${globals.api}/events");
var responseGet = await http.get(urlGet, var responseGet = await http.get(urlGet,
headers: {HttpHeaders.cookieHeader: 'access_token=${accessToken}'}); headers: {HttpHeaders.cookieHeader: 'access_token=${accessToken}'});
stderr.writeln('Response Get status: ${responseGet.statusCode}'); stderr.writeln('Response Get status: ${responseGet.statusCode}');
if (responseGet.statusCode == 200) { if (responseGet.statusCode == 200) {
stderr.writeln('Username : ${responseGet.body}'); stderr.writeln('Username : ${responseGet.body}');
var json = jsonDecode(responseGet.body); var json = jsonDecode(utf8.decode(responseGet.bodyBytes));
for (var user in json) { for (var user in json) {
stderr.writeln('email : ${user['email']}'); stderr.writeln('name : ${user['name']}');
former = "$former\n ${user['email']}"; former = "$former\n ${user['name']} : ${user["place"]}";
} }
} else { } else {
var text = ""; var text = "";