Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ValueListenableBuilder for NT widget state #110

Merged
merged 16 commits into from
Oct 12, 2024
Merged

Conversation

Gold872
Copy link
Owner

@Gold872 Gold872 commented Oct 8, 2024

Instead of using StreamBuilders which can be slow, constantly create futures and timers, and don't work well with multi-topic widgets, ValueListenableBuilders only get called when the subscription actually updates.

CPU usage has decreased by 10-15%

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 90.51522% with 81 lines in your changes missing coverage. Please review.

Project coverage is 66.15%. Comparing base (076925d) to head (827a091).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...gets/nt_widgets/multi-topic/robot_preferences.dart 72.58% 17 Missing ⚠️
lib/widgets/nt_widgets/nt_widget.dart 77.19% 13 Missing ⚠️
lib/services/nt4_client.dart 25.00% 6 Missing ⚠️
lib/services/nt_connection.dart 0.00% 6 Missing ⚠️
...ets/nt_widgets/multi-topic/basic_swerve_drive.dart 90.00% 5 Missing ⚠️
..._widgets/multi-topic/three_axis_accelerometer.dart 91.37% 5 Missing ⚠️
...widgets/nt_widgets/multi-topic/encoder_widget.dart 89.18% 4 Missing ⚠️
...b/widgets/network_tree/networktables_tree_row.dart 25.00% 3 Missing ⚠️
...ets/nt_widgets/multi-topic/differential_drive.dart 90.32% 3 Missing ⚠️
...b/widgets/nt_widgets/multi-topic/field_widget.dart 88.46% 3 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   63.94%   66.15%   +2.21%     
==========================================
  Files          77       77              
  Lines        7984     8014      +30     
==========================================
+ Hits         5105     5302     +197     
+ Misses       2879     2712     -167     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Gold872 Gold872 marked this pull request as ready for review October 12, 2024 17:33
@Gold872 Gold872 merged commit ab98358 into main Oct 12, 2024
5 checks passed
@Gold872 Gold872 deleted the value-listenable-builders branch October 12, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant