encryptDataToFile method

Future<String> encryptDataToFile(
  1. Uint8List srcData,
  2. String destFilePath
)

Encrypts binary data srcData to destFilePath file asynchronously.

Returns Future<String> that completes with the path to encrypted file once the entire operation has completed.

Implementation

Future<String> encryptDataToFile(
    Uint8List srcData, String destFilePath) async {
  destFilePath = destFilePath.trim();
  AesCryptArgumentError.checkNullOrEmpty(_password, 'Empty password.');
  AesCryptArgumentError.checkNullOrEmpty(
      destFilePath, 'Empty encrypted file path.');
  return await _Cryptor.init(_passBytes, _owMode, _userdata)
      .encryptDataToFile(srcData, destFilePath);
}