avoid_ positional_ boolean_ parameters
Details about the 'avoid_positional_boolean_parameters' diagnostic produced by the Dart analyzer.
'bool' parameters should be named parameters.
Description
#
The analyzer produces this diagnostic when a non-overriding,
public function has two or more positional parameters of type
bool.
A function with multiple positional Boolean parameters can be a source of ambiguity at call sites because the purpose of the specified Boolean values might not be clear from the values alone. Named parameters make their intent explicit.
Example
#
The following code produces this diagnostic because the
function f has two positional parameters with a
type of bool:
void f(bool a, bool b) {}
Common fixes
#Convert all of the positional parameters to be named parameters (possibly excepting one):
void f(bool a, {bool b = false}) {}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.