constant static method
void
constant({})
This static method allows adding constant values to specific maps in the Constants class.
Parameters:
key(required): The name of the value in the map. This parameter is required.value(required): The value to be appended to the map with the specified key. This parameter is required.override(optional): A boolean value indicating whether to override the existing value if the key already exists. Default value is false.type(optional): The type of the constant. It can be 'varchar', 'decimal', or 'custom'. If not specified or if the specified type is not recognized, the value will be added to the 'custom' map. Default value is ''.
Depending on the 'type' parameter, the method adds the key-value pair to the appropriate map in the Constants class. If the key already exists in the map and the 'override' parameter is set to true, the method updates the existing value. If the 'override' parameter is false, the method skips the addition.
After each operation, the method prints a message indicating the action taken.
Implementation
static void constant(
{@required required String key,
@required required String value,
bool override = false,
String type = ''}) {
switch (type.toLowerCase()) {
case ('varchar'):
_change(Constants.varchar, 'varchar', key, value, override);
break;
case ('decimal'):
_change(Constants.decimal, 'decimal', key, value, override);
break;
default:
_change(Constants.custom, 'custom', key, value, override);
break;
}
}