cocatenation et serialization json
This commit is contained in:
parent
b2f15acda8
commit
28c79a6ad2
@ -54,7 +54,7 @@ class MyHomePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
int _counter = 0;
|
String listUser = "";
|
||||||
|
|
||||||
Future<void> _incrementCounter() async {
|
Future<void> _incrementCounter() async {
|
||||||
var url = Uri.parse("http://localhost:8083/api/token");
|
var url = Uri.parse("http://localhost:8083/api/token");
|
||||||
@ -86,6 +86,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String former = "";
|
||||||
stderr.writeln("User ${user}");
|
stderr.writeln("User ${user}");
|
||||||
stderr.writeln("Jwt ${jwt}");
|
stderr.writeln("Jwt ${jwt}");
|
||||||
stderr.writeln('Response status: ${response.statusCode}');
|
stderr.writeln('Response status: ${response.statusCode}');
|
||||||
@ -97,13 +98,18 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
stderr.writeln('Response Get status: ${responseGet.statusCode}');
|
stderr.writeln('Response Get status: ${responseGet.statusCode}');
|
||||||
stderr.writeln('Response Get body: ${responseGet.body}');
|
stderr.writeln('Response Get body: ${responseGet.body}');
|
||||||
|
var json = jsonDecode(responseGet.body);
|
||||||
|
for (var user in json) {
|
||||||
|
former = "$former\n ${user['name']}";
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
// This call to setState tells the Flutter framework that something has
|
// This call to setState tells the Flutter framework that something has
|
||||||
// changed in this State, which causes it to rerun the build method below
|
// changed in this State, which causes it to rerun the build method below
|
||||||
// so that the display can reflect the updated values. If we changed
|
// so that the display can reflect the updated values. If we changed
|
||||||
// _counter without calling setState(), then the build method would not be
|
// _counter without calling setState(), then the build method would not be
|
||||||
// called again, and so nothing would appear to happen.
|
// called again, and so nothing would appear to happen.
|
||||||
_counter++;
|
listUser = former;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +151,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
'You have pushed the button this many times:',
|
'You have pushed the button this many times:',
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'$_counter',
|
'$listUser',
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headline4,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user