useConstantCase property

bool useConstantCase
final

Whether to convert field names from camelCase to CONSTANT_CASE when the @EnvField annotation is not explicitly assigned a varName.

By default, this is set to false, which means field names will retain their original camelCase format unless varName is specified. f

When set to true, field names will be automatically transformed into CONSTANT_CASE when no specific varName is provided in or no specifics useConstantCase value set to the @EnvField annotation. This follows the Effective Dart naming conventions where variables and field names start with lowercase letters and use uppercase for the first letter of each subsequent word.

Example:

@Envied(useUpperSnakeCase: true)
class MyEnvironment {
  @EnvField()
  String apiKey; // Transformed to 'API_KEY'

  @EnvField(varName: 'MY_TOKEN')
  String token; // Specified varName retains original format
}

Implementation

final bool useConstantCase;