undefined_ referenced_ parameter
The parameter '{0}' isn't defined by '{1}'.
Description
#
The analyzer produces this diagnostic when an annotation of the form
UseResult.unless(parameterDefined: parameterName)
specifies a parameter name that isn't defined by the annotated function.
Example
#
The following code produces this diagnostic because the function
f
doesn't have a parameter named
b
:
import 'package:meta/meta.dart';
@UseResult.unless(parameterDefined: 'b')
int f([int? a]) => a ?? 0;
Common fixes
#
Change the argument named
parameterDefined
to match the name of one of
the parameters to the function:
import 'package:meta/meta.dart';
@UseResult.unless(parameterDefined: 'a')
int f([int? a]) => a ?? 0;
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.