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
:
dart
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:
dart
import 'package:meta/meta.dart';
@UseResult.unless(parameterDefined: 'a')
int f([int? a]) => a ?? 0;
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。