EncryptionKey class abstract final Database Enterprise Edition

A key used to encrypt a Database.

This feature is only available in the Enterprise Edition.

This is an AES-256 key, which is 32 bytes long.

A key can be created from the raw bytes through key. It is important to use a cryptographically secure source of randomness to generate this key, for example Random.secure.

Alternatively a key can be derived from a password through passwordAsync or passwordAsync. If your UI uses passwords, call one of these method to create the key used to encrypt the database. They are designed for security, and deliberately run slowly to make brute-force attacks impractical.

See also:




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


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


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

Static Methods

key(Uint8List bytes) EncryptionKey
Creates an EncryptionKey from raw bytes.
passwordAsync(String password) Future<EncryptionKey>
Derives an EncryptionKey from a password.
passwordSync(String password) EncryptionKey
Derives an EncryptionKey from a password.