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
72828d66
Unverified
Commit
72828d66
authored
Jun 13, 2019
by
Michael Goderbauer
Committed by
GitHub
Jun 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include raw value in Diagnostics json for basic types (#34417)
parent
1c6cda9a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
diagnostics.dart
packages/flutter/lib/src/foundation/diagnostics.dart
+2
-0
diagnostics_test.dart
packages/flutter/test/foundation/diagnostics_test.dart
+37
-0
No files found.
packages/flutter/lib/src/foundation/diagnostics.dart
View file @
72828d66
...
@@ -2551,6 +2551,8 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
...
@@ -2551,6 +2551,8 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
json
[
'defaultLevel'
]
=
describeEnum
(
_defaultLevel
);
json
[
'defaultLevel'
]
=
describeEnum
(
_defaultLevel
);
if
(
value
is
Diagnosticable
||
value
is
DiagnosticsNode
)
if
(
value
is
Diagnosticable
||
value
is
DiagnosticsNode
)
json
[
'isDiagnosticableValue'
]
=
true
;
json
[
'isDiagnosticableValue'
]
=
true
;
if
(
value
is
num
||
value
is
String
||
value
is
bool
||
value
==
null
)
json
[
'value'
]
=
value
;
return
json
;
return
json
;
}
}
...
...
packages/flutter/test/foundation/diagnostics_test.dart
View file @
72828d66
...
@@ -2098,4 +2098,41 @@ void main() {
...
@@ -2098,4 +2098,41 @@ void main() {
)
)
);
);
});
});
test
(
'DiagnosticsProperty for basic types has value in json'
,
()
{
DiagnosticsProperty
<
int
>
intProperty
=
DiagnosticsProperty
<
int
>(
'int1'
,
10
);
Map
<
String
,
Object
>
json
=
simulateJsonSerialization
(
intProperty
);
expect
(
json
[
'name'
],
'int1'
);
expect
(
json
[
'value'
],
10
);
intProperty
=
IntProperty
(
'int2'
,
20
);
json
=
simulateJsonSerialization
(
intProperty
);
expect
(
json
[
'name'
],
'int2'
);
expect
(
json
[
'value'
],
20
);
DiagnosticsProperty
<
double
>
doubleProperty
=
DiagnosticsProperty
<
double
>(
'double'
,
33.3
);
json
=
simulateJsonSerialization
(
doubleProperty
);
expect
(
json
[
'name'
],
'double'
);
expect
(
json
[
'value'
],
33.3
);
doubleProperty
=
DoubleProperty
(
'double2'
,
33.3
);
json
=
simulateJsonSerialization
(
doubleProperty
);
expect
(
json
[
'name'
],
'double2'
);
expect
(
json
[
'value'
],
33.3
);
final
DiagnosticsProperty
<
bool
>
boolProperty
=
DiagnosticsProperty
<
bool
>(
'bool'
,
true
);
json
=
simulateJsonSerialization
(
boolProperty
);
expect
(
json
[
'name'
],
'bool'
);
expect
(
json
[
'value'
],
true
);
DiagnosticsProperty
<
String
>
stringProperty
=
DiagnosticsProperty
<
String
>(
'string1'
,
'hello'
);
json
=
simulateJsonSerialization
(
stringProperty
);
expect
(
json
[
'name'
],
'string1'
);
expect
(
json
[
'value'
],
'hello'
);
stringProperty
=
StringProperty
(
'string2'
,
'world'
);
json
=
simulateJsonSerialization
(
stringProperty
);
expect
(
json
[
'name'
],
'string2'
);
expect
(
json
[
'value'
],
'world'
);
});
}
}
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