diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index 12dc564..7ad9748 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -54,7 +54,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - int _counter = 0; + String listUser = ""; Future _incrementCounter() async { var url = Uri.parse("http://localhost:8083/api/token"); @@ -86,6 +86,7 @@ class _MyHomePageState extends State { } } } + String former = ""; stderr.writeln("User ${user}"); stderr.writeln("Jwt ${jwt}"); stderr.writeln('Response status: ${response.statusCode}'); @@ -97,13 +98,18 @@ class _MyHomePageState extends State { stderr.writeln('Response Get status: ${responseGet.statusCode}'); stderr.writeln('Response Get body: ${responseGet.body}'); + var json = jsonDecode(responseGet.body); + for (var user in json) { + former = "$former\n ${user['name']}"; + } + setState(() { // This call to setState tells the Flutter framework that something has // 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 // _counter without calling setState(), then the build method would not be // called again, and so nothing would appear to happen. - _counter++; + listUser = former; }); } @@ -145,7 +151,7 @@ class _MyHomePageState extends State { 'You have pushed the button this many times:', ), Text( - '$_counter', + '$listUser', style: Theme.of(context).textTheme.headline4, ), ],