encode method
Compact string representation for SharedPreferences-based active-model
persistence (#227). Format: <kind>|<value> where kind ∈ {network,
asset,bundled,file}. Auth tokens are NOT encoded — restored
network sources will re-request without auth and let the file system
service serve the previously-cached blob instead of re-downloading.
Implementation
String encode() => switch (this) {
NetworkSource(:final url) => 'network|$url',
AssetSource(:final path) => 'asset|$path',
BundledSource(:final resourceName) => 'bundled|$resourceName',
FileSource(:final path) => 'file|$path',
};