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.
"If you have to spend effort into looking at a fragment of code to figure out what it's doing, then you should extract it into a function and name the function after that 'what'."
"Use common sense, stick to small function sizes in most instances but don't be dogmatic about it if you have a genuinely good reason to make an unusually big function."
"All other things being equal, a shorter method is easier to read, easier to understand, and easier to troubleshoot. Refactor long methods into smaller methods if you can."
"The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that. Functions should not be 100 lines long. Functions should hardly ever be 20 lines long."
Unit Size Overall
There are 3,933 units with 42,583 lines of code in units (55.1% of code).
static void setup() in packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java
792
104
2
static void setup() in packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java
428
56
2
public void onMethodCall() in packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/MethodCallHandlerImpl.java
300
61
2
public void onMethodCall() in packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java
266
40
2
static void setup() in packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java
264
23
2
static void setup() in packages/webview_flutter/webview_flutter_android/lib/src/android_webview.pigeon.dart
Widget build() in packages/image_picker/image_picker/example/lib/main.dart
109
7
1
Widget build() in packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart
103
15
1
Widget build() in packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart
100
11
1
Future _handleMethodCall() in packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart
97
16
2
Widget build() in packages/url_launcher/url_launcher/example/lib/main.dart
97
3
1
Widget build() in packages/path_provider/path_provider/example/lib/main.dart