Short answer
Find the const nearest above the highlighted value and remove it, or move it down to the children that really are constant. If the value never changes, make it a constant instead (static const or a top-level const). Removing const is safe in ordinary widget code; it only gives up a small rebuild optimization. Where const is required (default parameter values, annotations, const variables), make the value itself constant instead.
Why the value isn’t constant, and the fix
01
A variable inside a const widget
“Either make all of the arguments constant expressions, or remove the const keyword to use the non-constant form of the constructor” Dart, const_with_non_constant_argument
const Text(title) fails because title is only known at runtime. The same goes for context, Theme.of(context), MediaQuery.of(context) or widget.something inside a const widget. Drop const from that widget; keep it on siblings that are fully constant.
// error const Padding( padding: EdgeInsets.all(16), child: Text(title), ); // fixed Padding( padding: const EdgeInsets.all(16), child: Text(title), );02
const applied to a whole list of children
children: const [ … ] makes every child constant. Adding one widget that uses a variable breaks the whole list. Remove const from the list and put it on the individual children that qualify.
children: [ const SizedBox(height: 8), Text(user.name), const Divider(), ],03
A value that should be a constant
A padding or color kept in a final field or a getter can’t be used in const code. If it never changes, declare it const.
class Spacing { static const double page = 16; } const EdgeInsets.all(Spacing.page)
Checked against the vendor’s docs on : Dart diagnostics: const_with_non_constant_argument.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
Related: Flutter “can’t be accessed in an initializer” · Flutter “The parameter can’t have a value of null” · Flutter “:app:compileFlutterBuildDebug” failed · Flutter “RangeError (index): Invalid value: Not in range”