diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index e5c1345ade..b2ecd9a903 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -2262,14 +2262,12 @@ class IterableProperty extends DiagnosticsProperty> { } } -/// An property than displays enum values tersely. +/// [DiagnosticsProperty] that has an [Enum] as value. /// -/// The enum value is displayed with the class name stripped. For example: +/// The enum value is displayed with the enum name stripped. For example: /// [HitTestBehavior.deferToChild] is shown as `deferToChild`. /// -/// This class can be used with classes that appear like enums but are not -/// "real" enums, so long as their `toString` implementation, in debug mode, -/// returns a string consisting of the class name followed by the value name. It +/// This class can be used with enums and returns the enum's name getter. It /// can also be used with nullable properties; the null value is represented as /// `null`. /// @@ -2277,7 +2275,7 @@ class IterableProperty extends DiagnosticsProperty> { /// /// * [DiagnosticsProperty] which documents named parameters common to all /// [DiagnosticsProperty]. -class EnumProperty extends DiagnosticsProperty { +class EnumProperty extends DiagnosticsProperty { /// Create a diagnostics property that displays an enum. /// /// The [level] argument must also not be null. @@ -2293,7 +2291,7 @@ class EnumProperty extends DiagnosticsProperty { if (value == null) { return value.toString(); } - return describeEnum(value!); + return value!.name; } } @@ -2975,11 +2973,16 @@ String describeIdentity(Object? object) => '${objectRuntimeType(object, '