getConstant method

dynamic getConstant(
  1. String palletName,
  2. String constantName
)

Get a constant value (lazy decoded)

Implementation

dynamic getConstant(String palletName, String constantName) {
  // Check if already decoded
  if (_decodedCache[palletName]?.containsKey(constantName) == true) {
    return _decodedCache[palletName]![constantName];
  }

  // Get metadata
  final info = getConstantInfo(palletName, constantName);
  if (info == null) {
    throw MetadataException('Constant $constantName not found in pallet $palletName');
  }

  // Decode and cache
  final value = _decodeConstant(info);
  _cacheConstant(palletName, constantName, value);

  return value;
}