diagnostic_ describe_ all_ properties
Details about the 'diagnostic_describe_all_properties' diagnostic produced by the Dart analyzer.
The public property isn't described by either 'debugFillProperties' or 'debugDescribeChildren'.
Description
#
The analyzer produces this diagnostic when a class that
implements
Diagnosticable has a public property that isn't
added as a property in either a
debugFillProperties or
debugDescribeChildren method.
Example
#
The following code produces this diagnostic because the
property p2 isn't added in the
debugFillProperties method:
import 'package:flutter/material.dart';
class const C({super.key}) extends Widget {
bool get p1 => true;
bool get p2 => false;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<bool>('p1', p1));
}
}
Common fixes
#
If there isn't on override of either the
debugFillProperties or
debugDescribeChildren method, then add one.
Add a description of the property in the
debugFillProperties or
debugDescribeChildren method:
import 'package:flutter/material.dart';
class const C({super.key}) extends Widget {
bool get p1 => true;
bool get p2 => false;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<bool>('p1', p1));
properties.add(DiagnosticsProperty<bool>('p2', p2));
}
}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.