toVariantDecodeResult static method
Converts JSON data into a BCS variant decode result.
Ensures the JSON structure has both key
and value
.
Implementation
static BcsVariantDecodeResult toVariantDecodeResult(
Map<String, dynamic> json) {
if (json['key'] is! String || !json.containsKey('value')) {
throw const BcsSerializationException(
'Invalid variant layout. only use enum layout to deserialize with `BcsVariantSerialization.deserialize` method.');
}
return BcsVariantDecodeResult(json);
}