File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class HomePage extends StatefulWidget {
1818}
1919
2020class _HomePageState extends State <HomePage > {
21- var jsonString = '' ;
21+ var result = '' ;
2222
2323 @override
2424 Widget build (BuildContext context) {
@@ -31,13 +31,27 @@ class _HomePageState extends State<HomePage> {
3131 mainAxisSize: MainAxisSize .min,
3232 mainAxisAlignment: MainAxisAlignment .center,
3333 children: [
34- Text (jsonString),
35- RaisedButton (
36- child: Text ('Read JSON' ),
37- onPressed: () async {
38- jsonString = await JSONLoader ().getJsonAsString ('assets/login_response.json' );
39- setState (() {});
40- },
34+ Text (result),
35+ Row (
36+ mainAxisAlignment: MainAxisAlignment .center,
37+ children: [
38+ RaisedButton (
39+ child: Text ('Read JSON As String' ),
40+ onPressed: () async {
41+ result = await JSONLoader ().getJsonAsString ('assets/login_response.json' );
42+ setState (() {});
43+ },
44+ ),
45+ SizedBox (width: 16 ),
46+ RaisedButton (
47+ child: Text ('Read JSON As Map' ),
48+ onPressed: () async {
49+ var jsonMap = await JSONLoader ().getJsonAsMap ('assets/login_response.json' );
50+ result = jsonMap['message' ];
51+ setState (() {});
52+ },
53+ ),
54+ ],
4155 ),
4256 ],
4357 ),
You can’t perform that action at this time.
0 commit comments