flutter / gallery
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 803 units with 63,074 lines of code in units (92.3% of code).
    • 75 very long units (50,960 lines of code)
    • 58 long units (3,970 lines of code)
    • 135 medium size units (4,373 lines of code)
    • 122 small units (1,812 lines of code)
    • 413 very small units (1,959 lines of code)
80% | 6% | 6% | 2% | 3%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart81% | 6% | 6% | 2% | 2%
cpp0% | 0% | 36% | 37% | 25%
cc0% | 0% | 47% | 18% | 33%
swift0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib/codeviewer99% | 0% | 0% | <1% | <1%
lib/data82% | 0% | 2% | 7% | 6%
lib/pages24% | 24% | 26% | 12% | 11%
lib/studies7% | 34% | 33% | 11% | 12%
tool/codeviewer_cli55% | 0% | 21% | 17% | 5%
lib/feature_discovery0% | 18% | 40% | 16% | 24%
tool/l10n_cli0% | 75% | 0% | 0% | 24%
lib0% | 0% | 46% | 13% | 40%
windows/runner0% | 0% | 36% | 37% | 25%
lib/layout0% | 0% | 39% | 31% | 28%
linux0% | 0% | 54% | 20% | 24%
lib/themes0% | 0% | 100% | 0% | 0%
tool0% | 0% | 0% | 0% | 100%
macos/Flutter0% | 0% | 0% | 0% | 100%
linux/flutter0% | 0% | 0% | 0% | 100%
windows/flutter0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static TextSpan dataTableDemo()
in lib/codeviewer/code_segments.dart
3204 1 1
static TextSpan transformationsDemo()
in lib/codeviewer/code_segments.dart
3107 1 1
static TextSpan openContainerTransformDemo()
in lib/codeviewer/code_segments.dart
2873 1 1
static TextSpan textFieldDemo()
in lib/codeviewer/code_segments.dart
2408 1 1
static TextSpan cardsDemo()
in lib/codeviewer/code_segments.dart
2371 1 1
static TextSpan cupertinoAlertDemo()
in lib/codeviewer/code_segments.dart
2125 1 1
static TextSpan customSlidersDemo()
in lib/codeviewer/code_segments.dart
2061 1 1
static TextSpan dialogDemo()
in lib/codeviewer/code_segments.dart
1818 1 1
static TextSpan colorsDemo()
in lib/codeviewer/code_segments.dart
1479 1 1
static TextSpan cupertinoPickersDemo()
in lib/codeviewer/code_segments.dart
1350 1 1
static TextSpan sharedXAxisTransitionDemo()
in lib/codeviewer/code_segments.dart
1277 1 1
static TextSpan pickerDemo()
in lib/codeviewer/code_segments.dart
1269 1 1
static TextSpan sharedZAxisTransitionDemo()
in lib/codeviewer/code_segments.dart
1244 1 1
static TextSpan gridListsDemo()
in lib/codeviewer/code_segments.dart
1108 1 1
static TextSpan bottomAppBarDemo()
in lib/codeviewer/code_segments.dart
987 1 1
static TextSpan sharedYAxisTransitionDemo()
in lib/codeviewer/code_segments.dart
985 1 1
static TextSpan bottomNavigationDemo()
in lib/codeviewer/code_segments.dart
935 1 1
static TextSpan fadeThroughTransitionDemo()
in lib/codeviewer/code_segments.dart
924 1 1
static TextSpan menuDemoChecklist()
in lib/codeviewer/code_segments.dart
918 1 1
static TextSpan fadeScaleTransitionDemo()
in lib/codeviewer/code_segments.dart
821 1 1