createByName method

ISerializable createByName(
  1. String entityName
)

Implementation

ISerializable createByName(String entityName) {
	var mapping = <String, ISerializable Function()>{
		'nemesis_block_v1': () => NemesisBlockV1(),
		'normal_block_v1': () => NormalBlockV1(),
		'importance_block_v1': () => ImportanceBlockV1()
	};

	if (!mapping.containsKey(entityName)) {
		throw Exception('Unknown Transaction type $entityName');
	}

	return mapping[entityName]!();
}