Why this matters
`const` values are computed at compile-time, improving performance compared to `final`, which is computed at runtime.
Replace `static final` with `const` where applicable to enable compile-time evaluation and optimize performance.
`const` values are computed at compile-time, improving performance compared to `final`, which is computed at runtime.
Side-by-side examples engineers can pattern-match during review.
final i = 1000; // Noncompliant
final ints = const [1, 2, 3]; // Noncompliant
class MyClass {
static final title = "NAME"; // Noncompliant
}const i = 1000;
const ints = [1, 2, 3]; // const after assignment can be omitted
class MyClass {
static const title = "NAME";
}final i = 1000; // Noncompliant
final ints = const [1, 2, 3]; // Noncompliant
class MyClass {
static final title = "NAME"; // Noncompliant
}const i = 1000;
const ints = [1, 2, 3]; // const after assignment can be omitted
class MyClass {
static const title = "NAME";
}From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.