createByName method
Implementation
ISerializable createByName(String entityName) {
var mapping = <String, ISerializable Function()>{
'harvest_fee_receipt': () => HarvestFeeReceipt(),
'inflation_receipt': () => InflationReceipt(),
'lock_hash_created_fee_receipt': () => LockHashCreatedFeeReceipt(),
'lock_hash_completed_fee_receipt': () => LockHashCompletedFeeReceipt(),
'lock_hash_expired_fee_receipt': () => LockHashExpiredFeeReceipt(),
'lock_secret_created_fee_receipt': () => LockSecretCreatedFeeReceipt(),
'lock_secret_completed_fee_receipt': () =>
LockSecretCompletedFeeReceipt(),
'lock_secret_expired_fee_receipt': () => LockSecretExpiredFeeReceipt(),
'mosaic_expired_receipt': () => MosaicExpiredReceipt(),
'mosaic_rental_fee_receipt': () => MosaicRentalFeeReceipt(),
'namespace_expired_receipt': () => NamespaceExpiredReceipt(),
'namespace_deleted_receipt': () => NamespaceDeletedReceipt(),
'namespace_rental_fee_receipt': () => NamespaceRentalFeeReceipt()
};
if (!mapping.containsKey(entityName)) {
throw Exception('Unknown Transaction type $entityName');
}
return mapping[entityName]!();
}