A constant expression is one of the following:
- A literal number.
- A literal boolean.
- A literal string where any interpolated expression is a compile-time constant that evaluates to a numeric, string or boolean value or to null.
- A literal symbol.
- null.
- A qualified reference to a static constant variable.
- An identifier expression that denotes a constant variable, class or type alias.
- A constant constructor invocation.
- A constant list literal.
- A constant map literal.
- A simple or qualified identifier denoting a top-level function or a static method.
- A parenthesized expression (e) where e is a constant expression.
- An expression of the form identical(e1, e2) where e1 and e2 are constant expressions and identical() is statically bound to the predefined dart function identical() discussed above.
- An expression of one of the forms e1 == e2 or e1 != e2 where e1 and e2 are constant expressions that evaluate to a numeric, string or boolean value.
- An expression of one of the forms !e, e1 && e2 or e1 || e2, where e, e1 and e2 are constant expressions that evaluate to a boolean value.
- An expression of one of the forms ~e, e1 ^ e2, e1 & e2, e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions that evaluate to an integer value or to null.
- An expression of one of the forms -e, e1 + e2, e1 - e2, e1 * e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, where e, e1 and e2 are constant expressions that evaluate to a numeric value or to null.
- An expression of the form e1 ? e2 : e3 where e1, e2 and e3 are constant expressions, and e1 evaluates to a boolean value.
|
|
|
|
|
|
|
|
|
|