Skip to content

Conversation

@goderbauer
Copy link
Member

@goderbauer goderbauer commented Jun 6, 2019

Description

Extracts the serialization logic for DiagnosticsNodes from the WidgetInspector, generalizes it, and puts it into diagnostics.dart to make it re-usable for #29375.

Related Issues

Pre-work for #29375

Tests

I added the following tests:

  • Tests for the new ColorDiagnosticsProperty, IconDataDiagnosticsProperty, and DiagnosticsSerializerDelegate.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • DiagnosticsNode.toJsonMap now takes a SerializationDelegate.

@goderbauer goderbauer force-pushed the diag2 branch 2 times, most recently from 69c7a23 to 6d441db Compare June 6, 2019 22:01
@Piinks Piinks added the framework flutter/packages/flutter repository. See also f: labels. label Jun 7, 2019
@goderbauer goderbauer changed the title WIP - Move json properties WIP - Extract DiagnosticsNode serializer from WidgetInspector Jun 10, 2019
@goderbauer goderbauer requested review from Hixie and jacob314 June 10, 2019 22:44
@goderbauer goderbauer changed the title WIP - Extract DiagnosticsNode serializer from WidgetInspector Extract DiagnosticsNode serializer from WidgetInspector Jun 10, 2019
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pq with this change we would need to add a lint to warn if DiagnosticsProperty is used instead of ColorDiagnosticsProperty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a bit odd. I would expect this is the delegate that should be used when expanding the properties of the value not for everything.
This could do strange things for nodes with zero properties, a Diagnosticable value and multiple children. Granted that is a bit of an edge case but the behavior would be quite surprising.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what you mean by this? What should the delegate do? I have changed the logic here a little bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pq This one also needs a lint so we don't get bugs when someone uses DiagnosticsProperty instead.

@Piinks Piinks added the a: tests "flutter test", flutter_test, or one of our tests label Jun 11, 2019
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
Lgtm with a couple small nits.

@goderbauer goderbauer merged commit eb9160e into flutter:master Jun 13, 2019
@goderbauer goderbauer deleted the diag2 branch June 13, 2019 18:30
tango5614 added a commit to tango5614/flutter that referenced this pull request Jun 14, 2019
* master: (24 commits)
  [flutter_tool,fuchsia] Update the install flow for packaging migration. (flutter#34447)
  SliverFillRemaining flag for different use cases (flutter#33627)
  SizedBox documentation (flutter#34424)
  Change API doc link to api.dart.dev (flutter#34388)
  2589785 Roll src/third_party/skia 87e885038893..c3252a04b377 (3 commits) (flutter/engine#9327) (flutter#34484)
  ace5d59 Fix rawTypes errors in Android embedding classes (flutter/engine#9326) (flutter#34481)
  bf0def6 Roll src/third_party/skia 4c4945a25248..87e885038893 (1 commits) (flutter/engine#9325) (flutter#34471)
  Roll engine f1d821d..6f5347c (13 commits) (flutter#34466)
  Allow "from" hero state to survive hero animation in a push transition (flutter#32842)
  Roll pub dependencies (flutter#33677)
  Skip flaky test on Windows (flutter#34464)
  Allow flaky tests to pass or fail and mark web tests as flaky (flutter#34456)
  Dont depend on web SDK unless running tests on chrome (flutter#34457)
  Fix semantics_tester (flutter#34368)
  Include raw value in Diagnostics json for basic types (flutter#34417)
  Refactor Gradle plugin (flutter#34353)
  Allow web tests to fail in cirrus config (flutter#34436)
  skip bottom_sheet (flutter#34430)
  Remove unused flag `--target-platform` from `flutter run` (flutter#34369)
  Extract DiagnosticsNode serializer from WidgetInspector (flutter#34012)
  ...
test('IconDataDiagnosticsProperty includes valueProperties in JSON', () {
IconDataProperty property = IconDataProperty('foo', const IconData(101010));
final Map<String, Object> valueProperties = property.toJsonMap(const DiagnosticsSerializationDelegate())['valueProperties'];
print(valueProperties);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nooooooooooo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #35408. Sorry :(

@goderbauer goderbauer mentioned this pull request Jul 1, 2019
9 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: tests "flutter test", flutter_test, or one of our tests customer: espresso framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants