Info.fromJson constructor

Info.fromJson(
  1. Map<String, dynamic> json
)

Creates an Info instance from a JSON map.

Parses the contact field into a Contact object if it exists.

Implementation

factory Info.fromJson(Map<String, dynamic> json) {
  printMap("The metadata information of an API:", json);
  return Info(
    title: json['title'] as String,
    description: json['description'] as String,
    version: json['version'] as String,
    contact:
        json['contact'] != null ? Contact.fromJson(json['contact']) : null,
  );
}