toJson method

Map<String, dynamic> toJson()

Returns a Map<String, dynamic> of the Resource

Implementation

Map<String, dynamic> toJson() {
  final val = <String, dynamic>{};

  void writeNotNull(String key, dynamic value) {
    if (value != null) {
      val[key] = value;
    }
  }

  writeNotNull('resourceType', resourceType);
  writeNotNull('id', fhirId);
  writeNotNull('meta', meta?.toJson());
  writeNotNull('implicitRules', implicitRules?.toJson());
  writeNotNull('_implicitRules', implicitRulesElement?.toJson());
  writeNotNull('language', language?.toJson());
  writeNotNull('_language', languageElement?.toJson());
  writeNotNull('text', text?.toJson());
  writeNotNull('contained', contained?.map((e) => e.toJson()).toList());
  writeNotNull('extension', extension_?.map((e) => e.toJson()).toList());
  writeNotNull('modifierExtension',
      modifierExtension?.map((e) => e.toJson()).toList());
  return val;
}