parseAsset method
Parses a Jetleaf Asset
into a Map<String, dynamic>
.
The default implementation converts the asset's bytes to a string and delegates to parse. Implementations may override this for more efficient handling (e.g., decoding binary formats).
Example:
final asset = Asset('config.json');
final config = parser.parseAsset(asset);
print(config['host']); // localhost
Implementation
@override
Map<String, dynamic> parseAsset(Asset asset) {
try {
return super.parseAsset(asset);
} catch (e) {
throw ParserException('Failed to parse ENV asset ${asset.getFileName()}: $e');
}
}