Add CpuProfileDataJson extension type for handling this data (#6980)

An alternative to some of the code in https://github.com/flutter/devtools/pull/6948

Work towards https://github.com/flutter/devtools/issues/6929

This one is again fairly simple. `CpuProfileData.parse` used to handle all of the parsing as statements, and relies on a fair amount of dynamic calling. When we extract the field calls into extension type getters, the casting etc is isolated to that section of the code. The statements in `CpuProfileData.parse` get simpler.

This could probably be improved more; I think `CpuProfileMetaData()` should just accept a `_CpuProfileDataJson` and get the data it needs. But that can be for later. Or now. Also all of the null-aware code could also be moved into the extension type. Depending on the business logic. Is it ever important to know if `sampleCount` is `null`? Or can we default it to `0` at the root? Etc.
1 file changed
tree: 911498473f17673e1f18979ac63ed68854ee97c2
  1. .github/
  2. _markdown_images/
  3. bin/
  4. case_study/
  5. docs/
  6. packages/
  7. third_party/
  8. tool/
  9. .gitattributes
  10. .gitignore
  11. AUTHORS
  12. BETA_TESTING.md
  13. CODE_OF_CONDUCT.md
  14. CODEOWNERS
  15. CONTRIBUTING.md
  16. DOCUMENTATION.md
  17. flutter-candidate.txt
  18. LICENSE
  19. README.md
  20. STYLE.md
  21. TESTING.md
README.md

Dart & Flutter DevTools

Build Status OpenSSF Scorecard

What is this?

Dart & Flutter DevTools is a suite of performance tools for Dart and Flutter.

Getting started

For documentation on installing and trying out DevTools, please see our docs.

Contributing and development

Contributions welcome! See our contributing page for an overview of how to build and contribute to the project.

Terms and Privacy

By using Dart DevTools, you agree to the Google Terms of Service. To understand how we use data collected from this service, see the Google Privacy Policy.