Content.fromJson constructor

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

Creates a Content from JSON.

Implementation

factory Content.fromJson(Map<String, dynamic> json) => Content(
  role: json['role'] as String?,
  parts: ((json['parts'] as List?) ?? [])
      .map((e) => Part.fromJson(e as Map<String, dynamic>))
      .toList(),
);