keyDeclarationFromKeyMeta function
Generates a key declaration within the key class
keyMeta
is the information about the key.
Returns the key declaration.
Implementation
String keyDeclarationFromKeyMeta(KeyMeta keyMeta) {
late String keyDeclaration;
if (keyMeta.isFunction) {
keyDeclaration = '\tstatic Key ${keyMeta.keyName}(Object object) => '
"Key('\${_prefix}${keyMeta.keyName}__\$object');";
} else {
keyDeclaration = '\tstatic const Key ${keyMeta.keyName} = '
"Key('\${_prefix}${keyMeta.keyName}');";
}
return keyDeclaration;
}