useConstantCase property

bool? useConstantCase

Whether to convert the field name to CONSTANT_CASE.

By default, this is set to false, which means that the field name will retain its original format unless varName is specified.

When set to true, the field name will be automatically transformed into CONSTANT_CASE. This follows the Dart convention for constant names where all letters are capitalized, and words are separated by underscores.


@EnvField(useConstantCase: true)
String apiKey; // Transformed to 'API_KEY'


final bool? useConstantCase;