delete method
Delete specific resource
Implementation
Future<bool> delete({
Resource? resource,
Dstu2ResourceType? resourceType,
String? id,
bool Function(Map<String, dynamic>)? finder,
String? pw,
}) async {
if (resource != null &&
resource.resourceType != null &&
resource.fhirId != null) {
return _deleteById(
resourceType: resource.resourceType!,
id: resource.fhirId!.value!,
pw: pw,
);
} else if (resourceType != null && id != null) {
return _deleteById(
resourceType: resourceType,
id: id,
pw: pw,
);
} else if (resourceType != null && finder != null) {
return _deleteFromDb(
resourceType: resourceType,
finder: finder,
pw: pw,
);
} else {
throw const FormatException('Must have either: '
'\n1) a resource with a resourceType'
'\n2) a resourceType and an Id'
'\n3) a resourceType, a specific field, and the value of interest');
}
}