diagnostic_describe_all_properties
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/foundation.dart';
import 'package:flutter/material.dart';
class C 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/foundation.dart';
import 'package:flutter/material.dart';
class C 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.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。