EncryptedCast class

Cast attribute to/from encrypted values

Uses SHA-256 hashing for one-way encryption (good for passwords). For two-way encryption, extend this class and implement your own logic.

Example:

Map<String, Type> get casts => {
  'password': EncryptedCast,
  'api_key': EncryptedCast,
};

// Usage:
user.password = 'secret123'; // Auto-hashed on set
// Cannot retrieve original password (one-way hash)
Inheritance

Constructors

EncryptedCast()

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

get(dynamic value) String?
Convert database value to model property value
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(String? value) → dynamic
Convert model property value to database value
override
toString() String
A string representation of this object.
inherited

Operators

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