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
1b406159
Unverified
Commit
1b406159
authored
Jul 16, 2020
by
Michael Goderbauer
Committed by
GitHub
Jul 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give better error message for describeEnum (#61581)
parent
293a2bf8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
diagnostics.dart
packages/flutter/lib/src/foundation/diagnostics.dart
+4
-1
diagnostics_test.dart
packages/flutter/test/foundation/diagnostics_test.dart
+8
-0
No files found.
packages/flutter/lib/src/foundation/diagnostics.dart
View file @
1b406159
...
...
@@ -3032,7 +3032,10 @@ String describeIdentity(Object? object) => '${objectRuntimeType(object, '<optimi
String
describeEnum
(
Object
enumEntry
)
{
final
String
description
=
enumEntry
.
toString
();
final
int
indexOfDot
=
description
.
indexOf
(
'.'
);
assert
(
indexOfDot
!=
-
1
&&
indexOfDot
<
description
.
length
-
1
);
assert
(
indexOfDot
!=
-
1
&&
indexOfDot
<
description
.
length
-
1
,
'The provided object "
$enumEntry
" is not an enum.'
,
);
return
description
.
substring
(
indexOfDot
+
1
);
}
...
...
packages/flutter/test/foundation/diagnostics_test.dart
View file @
1b406159
...
...
@@ -903,6 +903,14 @@ void main() {
expect
(
describeEnum
(
ExampleEnum
.
hello
),
equals
(
'hello'
));
expect
(
describeEnum
(
ExampleEnum
.
world
),
equals
(
'world'
));
expect
(
describeEnum
(
ExampleEnum
.
deferToChild
),
equals
(
'deferToChild'
));
expect
(
()
=>
describeEnum
(
'Hello World'
),
throwsA
(
isAssertionError
.
having
(
(
AssertionError
e
)
=>
e
.
message
,
'message'
,
'The provided object "Hello World" is not an enum.'
),
),
);
});
test
(
'string property test'
,
()
{
...
...
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