Skip to content

Files

Latest commit

 

History

History
37 lines (26 loc) · 799 Bytes

constant_identifier_names.md

File metadata and controls

37 lines (26 loc) · 799 Bytes

Pattern: Invalid constant identifier name

Issue: -

Description

In new code, use lowerCamelCase for constant variables, including enum values.

In existing code that uses ALL_CAPS_WITH_UNDERSCORES for constants, you may continue to use all caps to stay consistent.

Example of correct code:

const pi = 3.14;
const defaultTimeout = 1000;
final urlScheme = new RegExp('^([a-z]+):');

class Dice {
 static final numberGenerator = new Random();
}

Example of incorrect code:

const PI = 3.14;
const kDefaultTimeout = 1000;
final URL_SCHEME = new RegExp('^([a-z]+):');

class Dice {
 static final NUMBER_GENERATOR = new Random();
}

Further Reading