encryptAndSetMainAttachment method

Future<EncryptedDocument> encryptAndSetMainAttachment(
  1. String sdkId,
  2. Document document,
  3. List<String>? utis,
  4. Uint8List attachment,
)

Implementation

Future<EncryptedDocument> encryptAndSetMainAttachment(String sdkId, Document document, List<String>? utis, Uint8List attachment) async {
	final res = await _methodChannel.invokeMethod<String>(
		'DocumentApi.encryptAndSetMainAttachment',
		{
			"sdkId": sdkId,
			"document": jsonEncode(Document.encode(document)),
			"utis": jsonEncode(utis?.map((x0) => x0).toList()),
			"attachment": jsonEncode(base64Encode(attachment as List<int>)),
		}
	);
	if (res == null) throw AssertionError("received null result from platform method encryptAndSetMainAttachment");
	final parsedResJson = jsonDecode(res);
	return EncryptedDocument.fromJSON(parsedResJson);
}