Skip to content

Files

Latest commit

 

History

History
30 lines (21 loc) · 531 Bytes

prefer_const_declarations.md

File metadata and controls

30 lines (21 loc) · 531 Bytes

Pattern: Missing use of const

Issue: -

Description

Const declarations are more hot-reload friendly and allow to use const constructors if an instantiation references this declaration.

Example of correct code:

const o = const [];

class A {
 static const o = const [];
}

Example of incorrect code:

final o = const [];

class A {
 static final o = const [];
}

Further Reading