AesEncryptFileWeb class

Flutter Web implementation of AesEncryptFilePlatform.

Encryption and decryption use the browser's native WebCrypto engine (AES-256-CTR), producing output that is wire-compatible with the Android (OpenSSL) and iOS (CommonCrypto) native implementations.

File I/O on web

Because browsers do not expose a writable local filesystem, this implementation maintains an in-memory virtual filesystem (_virtualFileSystem). The caller should:

  • Pre-load source bytes under the desired inputPath key via storeVirtualFile before calling encryptFile / decryptFile, or
  • Pass a URL (http:/https:/blob:) as inputPath; the implementation will fetch the bytes automatically.

Encrypted / decrypted output is stored in _virtualFileSystem under outputPath. Retrieve the bytes with getVirtualFile.

Inheritance

Constructors

AesEncryptFileWeb()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decryptBytes({required Uint8List cipherBytes, required String key, String? iv}) Future<Uint8List>
Decrypts cipherBytes (format: [16-byte IV][ciphertext]) and returns the original plaintext.
override
decryptFile({required String inputPath, required String outputPath, required String key, String? iv}) Future<bool>
Decrypts the file at inputPath and writes the result to outputPath.
override
encryptBytes({required Uint8List plainBytes, required String key, String? iv}) Future<Uint8List>
Encrypts plainBytes and returns [16-byte IV][ciphertext].
override
encryptFile({required String inputPath, required String outputPath, required String key, String? iv}) Future<bool>
Encrypts the file at inputPath and writes the result to outputPath.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getVirtualFile(String path) Uint8List?
Returns the bytes previously written to path, or null if absent.
registerWith(Registrar registrar) → void
storeVirtualFile(String path, Uint8List bytes) → void
Stores bytes under path so they can be used as input to encryptFile or decryptFile.