required property
Whether a launch that sets no value for this knob is refused.
The second thing a signature cannot say, and for a harder reason than
from. A knob is an optional named parameter, and
void main({required String x}) is not an entry point at all: Flutter's
bootstrap calls main() with no arguments, so the word required in the
signature stops the file running under plain flutter run. That is why a
parameter genuinely declared required is reported as unlaunchable rather
than as a knob to fill in — there is no way to satisfy it and keep the
entry point.
So the parameter keeps a default, because it has to, and this says the default is a placeholder rather than a value anybody meant to run against:
// lib/main_dev.dart — still launchable by hand
void main({String apiToken = const String.fromEnvironment('API_TOKEN')})
// tool/flutterware.dart — but not by flutterware without one
Knob('apiToken', required: true),
A from that answers satisfies it. The point is that some value was
chosen for this launch, not that a human typed it — which is what makes
required with a working source a declaration rather than a chore.
The refusal comes before anything is built, which is the whole value. Left to the app, forgetting one costs a compile, an install, a boot and whatever the code does about a placeholder — usually throwing somewhere that names neither the knob nor the launch, minutes after the mistake.
Implementation
final bool required;