Your Second Flutter App

Nov 30 2021 · Dart 2.13, Flutter 2.2.3, Visual Studio Code

Part 1: Parse Network Data

06. Parse the Network Response

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 05. Make a Network Call Next episode: 07. Challenge: Add More Properties

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

In the last episode, you made a network request and received data back by way of JSON. JSON groups responses into objects and lists of objects. The objects are indicated by curly braces, while lists of objects are created using square brackets. Objects and lists can be nested inside one another.

https://api.raywenderlich.com/api/contents?filter[content_types][]=collection
  Course.fromJson(Map<String, dynamic> json);
Course.fromJson(Map<String, dynamic> json)
      : courseId = json['id'] as String,
        name = json['attributes']['name'] as String,
        description = json['attributes']['description_plain_text'] as String;
  @override
  String toString() {
    return name;
  }
  final data = apiResponse['data'] as List;
  for (final json in data) {
    courses.add(Course.fromJson(json as Map<String, dynamic>));
  }
if (courses == null) {
  return const Center(child: CircularProgressIndicator());
}
return Text(courses.toString());