flutter_perf_lints 0.1.0
flutter_perf_lints: ^0.1.0 copied to clipboard
Analyzer plugin that flags Flutter performance problems: undisposed controllers, full-size image decodes, eager lists, animated Opacity and heavy build work.
0.1.0 #
First release, built on the official Dart analyzer plugin system
(analysis_server_plugin, Dart 3.10+).
Rules (all on by default):
undisposed_controller(warning): controllers, focus nodes, notifiers, stream subscriptions and timers created by aStateand never released. Quick fix: release it indispose()(creating the method if needed).image_without_cache_size:Image.network/asset/file/memorywithoutcacheWidth/cacheHeight, andNetworkImage/FileImage/MemoryImagenot wrapped inResizeImage.prefer_list_builder:ListView/GridView(andColumn/Rowdirectly in aSingleChildScrollView) whosechildrencome from.map(),List.generateor a collection-for. Quick fix forListView(children: xs.map(...).toList()).avoid_animated_opacity_widget:Opacitydriven by an animation value or built inside anAnimatedBuilder.prefer_riverpod_select:final x = ref.watch(p)where only one property ofxis ever read. Quick fix:ref.watch(p.select((v) => v.prop)).avoid_setstate_large_subtree:setStatein aStatewhosebuildis longer than 60 lines or has more than 25 widget constructors.avoid_heavy_work_in_build:jsonDecode,RegExp(...),DateFormat(...),NumberFormat(...),.sort()and synchronous file I/O insidebuild.