This app parses a JSON string and shows the title in the app bar and the count in the center.
import 'dart:convert';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
const jsonString = '{"title":"Hello Flutter","count":5}';
final Map<String, dynamic> data = jsonDecode(jsonString);
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text(data['title'])),
body: Center(
child: Text('Count is: ${data['count']}'),
),
),
);
}
}