withEncryptionMetadata method

Future<GroupScoped<DecryptedPatient>> withEncryptionMetadata(
  1. String sdkId,
  2. String entityGroupId,
  3. DecryptedPatient? base,
  4. User? user,
  5. Map<EntityReferenceInGroup, AccessLevel> delegates,
)

Implementation

Future<GroupScoped<DecryptedPatient>> withEncryptionMetadata(String sdkId, String entityGroupId, DecryptedPatient? base, User? user, Map<EntityReferenceInGroup, AccessLevel> delegates) async {
	final res = await _methodChannel.invokeMethod<String>(
		'PatientApi.inGroup.withEncryptionMetadata',
		{
			"sdkId": sdkId,
			"entityGroupId": jsonEncode(entityGroupId),
			"base": jsonEncode(base == null ? null : DecryptedPatient.encode(base!)),
			"user": jsonEncode(user == null ? null : User.encode(user!)),
			"delegates": jsonEncode(delegates.entries.map((x0) => {
				"k": EntityReferenceInGroup.encode(x0.key),
				"v": AccessLevel.encode(x0.value),
			}).toList()),
		}
	).catchError(convertPlatformException);
	if (res == null) throw AssertionError("received null result from platform method withEncryptionMetadata");
	final parsedResJson = jsonDecode(res);
	return GroupScoped.fromJSON(
		parsedResJson,
		(x1) {
			return DecryptedPatient.fromJSON(x1);
		},
	);
}