Why this matters
An `@immutable` class should only have `const` constructors to enforce immutability and improve performance.
Define constructors for `@immutable` classes as `const` to ensure that instances are created efficiently and cannot be modified.
An `@immutable` class should only have `const` constructors to enforce immutability and improve performance.
Side-by-side examples engineers can pattern-match during review.
import 'package:meta/meta.dart';
@immutable
class Point {
final int x;
final int y;
Point(this.x, this.y); // Non compliant
}import 'package:meta/meta.dart';
@immutable
class Point {
final int x;
final int y;
const Point(this.x, this.y);
}import 'package:meta/meta.dart';
@immutable
class Point {
final int x;
final int y;
Point(this.x, this.y); // Non compliant
}import 'package:meta/meta.dart';
@immutable
class Point {
final int x;
final int y;
const Point(this.x, this.y);
}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.