Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6da6fbf5
Unverified
Commit
6da6fbf5
authored
Aug 09, 2023
by
Bernardo Ferrari
Committed by
GitHub
Aug 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate `describeEnum`. (#125016)
Final part of
https://github.com/flutter/flutter/issues/123346
.
parent
f5ceaf98
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
diagnostics.dart
packages/flutter/lib/src/foundation/diagnostics.dart
+10
-7
No files found.
packages/flutter/lib/src/foundation/diagnostics.dart
View file @
6da6fbf5
...
...
@@ -2262,14 +2262,12 @@ class IterableProperty<T> extends DiagnosticsProperty<Iterable<T>> {
}
}
///
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<T> extends DiagnosticsProperty<Iterable<T>> {
///
/// * [DiagnosticsProperty] which documents named parameters common to all
/// [DiagnosticsProperty].
class
EnumProperty
<
T
>
extends
DiagnosticsProperty
<
T
>
{
class
EnumProperty
<
T
extends
Enum
?
>
extends
DiagnosticsProperty
<
T
>
{
/// Create a diagnostics property that displays an enum.
///
/// The [level] argument must also not be null.
...
...
@@ -2293,7 +2291,7 @@ class EnumProperty<T> extends DiagnosticsProperty<T> {
if
(
value
==
null
)
{
return
value
.
toString
();
}
return
describeEnum
(
value
!)
;
return
value
!.
name
;
}
}
...
...
@@ -2975,11 +2973,16 @@ String describeIdentity(Object? object) => '${objectRuntimeType(object, '<optimi
///
/// void validateDescribeEnum() {
/// assert(Day.monday.toString() == 'Day.monday');
/// // ignore: deprecated_member_use
/// assert(describeEnum(Day.monday) == 'monday');
/// assert(Day.monday.name == 'monday'); // preferred for real enums
/// }
/// ```
/// {@end-tool}
@Deprecated
(
'Use the `name` getter on enums instead. '
'This feature was deprecated after v3.10.0-1.1.pre.'
)
String
describeEnum
(
Object
enumEntry
)
{
if
(
enumEntry
is
Enum
)
{
return
enumEntry
.
name
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment