flutter / packages
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 1,003 units with 16,546 lines of code in units (62.8% of code).
    • 15 very long units (3,365 lines of code)
    • 29 long units (1,942 lines of code)
    • 161 medium size units (4,969 lines of code)
    • 220 small units (3,253 lines of code)
    • 578 very small units (3,017 lines of code)
20% | 11% | 30% | 19% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart22% | 12% | 30% | 16% | 17%
cpp0% | 0% | 14% | 59% | 25%
cc0% | 0% | 50% | 22% | 26%
m0% | 0% | 41% | 27% | 31%
kt0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/rfw27% | 8% | 20% | 24% | 19%
packages/pigeon27% | 12% | 30% | 12% | 17%
packages/animations14% | 23% | 37% | 12% | 12%
packages/flutter_markdown16% | 8% | 40% | 22% | 11%
packages/web_benchmarks17% | 5% | 32% | 25% | 19%
packages/multicast_dns20% | 8% | 34% | 20% | 14%
packages/pointer_interceptor55% | 0% | 0% | 14% | 29%
packages/fuchsia_ctl0% | 22% | 33% | 23% | 20%
packages/palette_generator0% | 14% | 46% | 20% | 18%
packages/flutter_image0% | 40% | 13% | 16% | 28%
packages/metrics_center0% | 0% | 51% | 25% | 22%
packages/extension_google_sign_in_as_googleapis_auth0% | 0% | 60% | 17% | 22%
packages/imitation_game0% | 0% | 21% | 52% | 25%
packages/xdg_directories0% | 0% | 0% | 57% | 42%
packages/cross_file0% | 0% | 0% | 0% | 100%
packages/flutter_lints0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
Iterable _tokenize()
in packages/rfw/lib/src/dart/text.dart
1316 778 1
void generateJava()
in packages/pigeon/lib/java_generator.dart
219 25 3
Future run()
in packages/web_benchmarks/lib/src/runner.dart
198 29 0
static void setup()
in packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
177 10 2
void generateDart()
in packages/pigeon/lib/dart_generator.dart
160 23 3
Widget build()
in packages/animations/example/lib/container_transition.dart
159 1 1
List? decodeMDnsResponse()
in packages/multicast_dns/lib/src/packet.dart
146 18 1
void visitElementAfter()
in packages/flutter_markdown/lib/src/builder.dart
138 31 1
void _writeHostApi()
in packages/pigeon/lib/java_generator.dart
134 17 2
Widget buildPage()
in packages/animations/lib/src/open_container.dart
133 9 3
void generateObjcSource()
in packages/pigeon/lib/objc_generator.dart
128 14 3
void _writeFlutterApi()
in packages/pigeon/lib/dart_generator.dart
122 17 5
void _writeHostApiSource()
in packages/pigeon/lib/objc_generator.dart
120 10 3
Widget build()
in packages/pointer_interceptor/example/lib/main.dart
109 1 1
MarkdownStyleSheet copyWith()
in packages/flutter_markdown/lib/src/style_sheet.dart
106 1 51
static Curve curve()
in packages/rfw/lib/src/flutter/argument_decoders.dart
97 45 3
List _validateAst()
in packages/pigeon/lib/pigeon_lib.dart
91 25 2
Widget build()
in packages/animations/example/lib/main.dart
83 3 1
Future pave()
in packages/fuchsia_ctl/lib/src/image_paver.dart
80 10 6
static Object _resolveFrom()
in packages/rfw/lib/src/flutter/runtime.dart
80 21 4