This video will explain how to parse complex json array in flutter.
Part 1: Read and parse json from asset or local resource.
Part 2: Call REST api , fetch json and parse json.
- For parsing, the json we need to fetch it from source and then create a model class for mapping JSON object into the custom type of Object that we will query in our flutter code.
- In this demo, we are reading a photos array from local json and remote json by calling API.
- After reading JSON we have created a ListView builder to pass the array and display a beautiful UI with the help of Listview widget.
https://api.flutter.dev/flutter/widgets/ListView-class.html
- Listview widget provides us leading, title, subtitle, trailing to create a beautiful UI.
- For making an API call, we have used http library from
https://pub.dev/packages/http
- For generating model classes we have used JSON to Dart model extension
https://marketplace.visualstudio.com/items?itemName=hirantha.json-to-dart
Github project repo:
https://github.com/raviyadav5951/json_parsing
------------------------------------
Chapters:
- 00:00 Introduction
- 01:38 Creating Stateful widgets.
- 05:50 Adding Navigation(Navigators)
- 09:00 Creating json in the assets
-12:00 Reading json from local assets
-19:00 Creating model classes from json response
-28:10 ListView widget
- 32:00 Calling API and fetching JSON from remote location