flutter / devtools
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 3,607 units with 52,321 lines of code in units (68.1% of code).
    • 27 very long units (3,907 lines of code)
    • 129 long units (8,512 lines of code)
    • 556 medium size units (17,134 lines of code)
    • 796 small units (11,491 lines of code)
    • 2,099 very small units (11,277 lines of code)
7% | 16% | 32% | 21% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart7% | 16% | 32% | 21% | 21%
cc0% | 0% | 29% | 46% | 24%
cpp0% | 0% | 71% | 28% | 0%
js0% | 0% | 52% | 0% | 47%
kt0% | 0% | 0% | 100% | 0%
swift0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
java0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/devtools_app6% | 16% | 33% | 22% | 21%
packages/devtools_server31% | 18% | 18% | 15% | 16%
packages/devtools_shared39% | 0% | 0% | 20% | 40%
case_study/code_size0% | 37% | 0% | 14% | 48%
tool/lib0% | 21% | 47% | 17% | 13%
case_study/memory_leak0% | 0% | 50% | 31% | 18%
tool0% | 0% | 71% | 21% | 6%
packages/devtools_test0% | 0% | 32% | 47% | 19%
case_study/memory_leaks0% | 0% | 66% | 18% | 14%
case_study/platform_channel0% | 0% | 59% | 12% | 27%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
Future serveDevTools()
in packages/devtools_server/lib/src/server.dart
279 38 18
String addServiceExtensions()
in packages/devtools_app/assets/scripts/inspector_polyfill_script.dart
229 27 0
void paint()
in packages/devtools_app/lib/src/charts/chart.dart
200 26 2
List childrenRenderProperties()
in packages/devtools_app/lib/src/inspector/inspector_data_models.dart
171 44 5
List buildTreemaps()
in packages/devtools_app/lib/src/charts/treemap.dart
163 31 6
static DateTime parse()
in packages/devtools_app/lib/src/http/_http_date.dart
161 17 1
Widget buildCodeArea()
in packages/devtools_app/lib/src/debugger/codeview.dart
152 9 1
void didChangeDependencies()
in packages/devtools_app/lib/src/memory/memory_screen.dart
150 23 0
FieldReference listToFieldEntries()
in packages/devtools_app/lib/src/memory/memory_snapshot_models.dart
150 32 6
void performLayout()
in packages/devtools_app/lib/src/primitives/extent_delegate_list.dart
149 23 0
Future buildVariablesTree()
in packages/devtools_app/lib/src/debugger/debugger_model.dart
141 36 3
Widget build()
in packages/devtools_app/lib/src/inspector/diagnostics.dart
140 31 1
Widget build()
in packages/devtools_app/lib/src/inspector/layout_explorer/ui/widget_constraints.dart
140 17 1
static FutureOr handle()
in packages/devtools_shared/lib/src/server/server_api.dart
137 32 3
void setupTraces()
in packages/devtools_app/lib/src/memory/memory_android_chart.dart
134 2 0
Widget _buildLayout()
in packages/devtools_app/lib/src/shared/split.dart
133 24 2
void setupTraces()
in packages/devtools_app/lib/src/memory/memory_events_pane.dart
132 3 1
Widget _buildChild()
in packages/devtools_app/lib/src/inspector/layout_explorer/box/box.dart
127 9 1
Widget _buildLayout()
in packages/devtools_app/lib/src/inspector/layout_explorer/flex/flex.dart
120 1 2
Widget tableRowFor()
in packages/devtools_app/lib/src/shared/table.dart
119 14 2