toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = {
    'model': model,
    'contents': contents.map((x) => x.toJson()).toList(),
  };
  if (safetySettings != null) {
    data['safety_settings'] =
        safetySettings?.map((x) => x.toJson()).toList();
  }
  if (generationConfig != null) {
    data['generation_config'] = generationConfig?.toJson();
  }
  return data;
}