toMap method
Converts the wrapper's state to a structured Map (matches the format defined in this class).
Core logic:
- Serializes the data property (TransportableData) into the "data" field of the Map
- Subclasses may override this method to implement lazy serialization for other properties (e.g., defer encoding large file data until this method is called)
Returns: Serialized Map containing the file metadata and serialized data
Implementation
@override
MutableMapping toMap() {
// serialize 'data'
var ted = _attachment;
if (ted != null && !containsKey('data')) {
_map['data'] = ted.serialize();
}
// serialize 'key'
var pwd = _password;
if (pwd != null && !containsKey('key')) {
_map['key'] = pwd.toMap();
}
// OK
return _map;
}