Dart constant variables must be initialized with compile-time constant expressions.
A compile-time constant expression must always have the same value—precisely one value per source location.
Dart doesn't have "constant values" as such. It has constant expressions, which are known to evaluate to precisely one value, and for which it's possible to know this value at compile-time. That allows the compiler to canonicalize those constants values, so different constant expressions evaluating to constant objects with the same state are canonicalized to be the same object.
Your amount
variable is not a compile-time constant expression. It can have different values at different times (because it's a function parameter and people might call the function with different arguments), so it cannot be a constant expression.
And therefore it cannot be used to initialize a constant variable, because constant variables can only have one value.
void test(int amount) {
const _amount = amount;
const list = [_amount]; // <- MUST ALWAYS HAVE SAME VALUE
}
In short: Dart constant variables must be initialized with a compile-time constant expression. A constant expression must always have the same value. This is the fundamental rule about Dart constant expressions which most other restrictions are derived from. (For example, a constant variable being used is a constant expression, so it must always be bound to the same value, which is why it must be initialized with a constant expression.)