saropa_lints 2.3.4
saropa_lints: ^2.3.4 copied to clipboard
1189+ custom lint rules for Flutter and Dart. Static analysis for security, accessibility, and performance. Free and open source. 5 tiers plus optional stylistic rules.
Changelog #
All notable changes to this project will be documented in this file. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Looking for older changes?
See CHANGELOG_ARCHIVE.md for versions 0.1.0 through 1.8.2.
2.3.4 - 2026-01-11 #
Fixed #
- avoid_dialog_context_after_async: Fixed
RangeErrorcrash when analyzing files wheretoSource()produces a different length string than the original source - avoid_set_state_after_async: Fixed the same
RangeErrorin_hasAwaitBeforemethod
2.3.3 - 2026-01-11 #
Changed #
- ENTERPRISE.md → PROFESSIONAL_SERVICES.md: Renamed and restructured with New Projects / Upgrade / Audit service framework
- README.md: Added adoption strategy paragraph; updated documentation links
- PROFESSIONAL_SERVICES.md: Consolidated phased approach into Upgrade section; removed redundant adoption section
- CONTRIBUTING.md: Added rule prohibiting TODO comments as quick fixes
- 41 rules: Updated doc headers to explain "Manual fix required:" for issues requiring human judgment
- 62 quick fixes: Converted remaining
// TODO:comments to// HACK:comments to avoid triggering thetodoanalyzer diagnostic
Improved #
Converted 25+ TODO quick fixes to real automated fixes:
- complexity_rules.dart:
AvoidCascadeAfterIfNullRulenow wraps??in parentheses - equality_rules.dart:
AvoidSelfAssignmentRulenow comments out the statement - structure_rules.dart:
- Double slash imports now get the extra slash removed
- Duplicate exports/imports/mixins now get commented out
- Mutable globals now get
finalkeyword added
- type_rules.dart:
- Implicitly nullable extensions now get
implements Objectadded - Nullable interpolations now get
?? ''added - Nullable params with defaults now get
?removed
- Implicitly nullable extensions now get
- exception_rules.dart:
- Non-final fields now get
finalkeyword added - Pointless rethrows now get try-catch commented out
- Throw in catch now gets replaced with
rethrow
- Non-final fields now get
- async_rules.dart:
- Future.ignore() now gets wrapped with
unawaited() - Unassigned subscriptions now get assigned to
final _ =
- Future.ignore() now gets wrapped with
- control_flow_rules.dart: Collapsible if statements now get combined with
&& - performance_rules.dart: setState in build now gets wrapped in
addPostFrameCallback - collection_rules.dart: Collection equality now gets wrapped with
DeepCollectionEquality().equals() - testing_best_practices_rules.dart: Future.delayed now gets replaced with
tester.pumpAndSettle() - test_rules.dart: GetIt tests now get
GetIt.I.reset()added to setUp - package_specific_rules.dart:
- File access now sets
allowFileAccess: false - Envied now gets
obfuscate: trueparameter - Image picker now gets
maxWidth/maxHeightparameters - API calls now get wrapped in try-catch
- Calendar events now get
timeZone: tz.localparameter
- File access now sets
Removed #
- 41 TODO quick fixes: Removed quick fixes that only added TODO comments (these just created noise by triggering the
todolint rule)
2.3.2 - 2026-01-11 #
Added #
Image & Package-Specific Rules (5 rules)
Image Picker Rules
prefer_image_picker_max_dimensions: Warns whenpickImage()is called withoutmaxWidth/maxHeightparameters - prevents OOM on high-resolution cameras (12-108MP). Quick fix available.
Cached Network Image Rules
prefer_cached_image_fade_animation: Suggests explicitly settingfadeInDurationon CachedNetworkImage for intentional UX design (default is 500ms).
URL Launcher Rules
require_url_launcher_mode: Warns whenlaunchUrl()is called withoutmodeparameter - behavior varies by platform without explicit mode.
SQLite Database Rules
avoid_sqflite_read_all_columns: Warns whenSELECT *is used inrawQuery()- wastes memory and bandwidth by fetching unnecessary columns.
Notification Rules
require_notification_initialize_per_platform: Warns whenInitializationSettingsis missingandroid:oriOS:parameters - notifications fail silently on missing platforms. Quick fix available.
Changed #
- Added aliases to pre-existing rules:
require_await_in_async→ alias foravoid_redundant_asyncavoid_riverpod_ref_in_dispose→ alias foravoid_ref_inside_state_disposeavoid_set_state_in_build→ alias foravoid_setstate_in_build
2.3.1 - 2026-01-11 #
Changed #
-
pass_existing_future_to_future_builder: Mergedavoid_future_builder_rebuildinto this rule- Now detects inline futures anywhere (not just in build method)
- Added
InstanceCreationExpressiondetection (e.g.,Future.value()) - Added alias note in documentation
-
avoid_uncaught_future_errors: Improved false positive handling- Now skips functions that have internal try-catch error handling
-
avoid_keyboard_overlap: Improved detection accuracy- Skips Dialog and BottomSheet widgets (Flutter handles keyboard overlap for these)
- Changed to file-level viewInsets check (handles nested widget composition)
-
require_webview_ssl_error_handling: Fixed callback name- Changed from
onSslErrortoonSslAuthError(correct API for webview_flutter 4.0+) - Removed
onHttpAuthRequestfrom check (different purpose: HTTP 401 auth, not SSL)
- Changed from
-
require_apple_signin_nonce: Improved documentation with Supabase example
Removed #
avoid_future_builder_rebuild: Merged intopass_existing_future_to_future_builder
2.3.0 - 2026-01-10 #
Added #
ROADMAP_NEXT Parts 1-7 Rules (11 new rules + ~70 rules registered in tiers)
GoRouter Navigation Rules (2 rules)
prefer_go_router_redirect_auth: Suggests using redirect callback instead of auth checks in page buildersrequire_go_router_typed_params: Warns when path parameters are used without type conversion
Provider State Management Rules (2 rules)
avoid_provider_in_init_state: Warns when Provider.of or context.read/watch is used in initStateprefer_context_read_in_callbacks: Suggests using context.read instead of context.watch in callbacks
Hive Database Rules (1 rule)
require_hive_type_id_management: Warns when @HiveType typeId may conflict with others
Image Picker Rules (1 rule)
require_image_picker_result_handling: Warns when pickImage result is not checked for null
Cached Network Image Rules (1 rule)
avoid_cached_image_in_build: Warns when CachedNetworkImage uses variable cacheKey in build
SQLite Migration Rules (1 rule)
require_sqflite_migration: Warns when onUpgrade callback doesn't check oldVersion
Permission Handler Rules (3 rules)
require_permission_rationale: Suggests checking shouldShowRequestRationale before requesting permissionrequire_permission_status_check: Warns when using permission-gated features without checking statusrequire_notification_permission_android13: Warns when notifications shown without POST_NOTIFICATIONS permission
Changed #
- Registered ~70 existing rules from Parts 1-7 into appropriate tiers (Essential, Recommended, Professional)
- All Isar, Dispose, Lifecycle, Widget, API, and Package-Specific rules now properly included in tier system
prefer_test_wrapper: Added to Recommended tier
Fixed #
avoid_uncaught_future_errors: Reduced false positives significantly:- Now recognizes
.then(onError: ...)as valid error handling - Skips
unawaited()wrapped futures (explicit acknowledgment) - Skips
.ignore()chained futures - Added 20+ safe fire-and-forget methods: analytics (
logEvent,trackEvent), cache (prefetch,warmCache), cleanup (dispose,drain)
- Now recognizes
require_stream_subscription_cancel: Fixed false positive for collection-based cancellation patterns. Now correctly recognizesfor (final sub in _subscriptions) { sub.cancel(); }and_subscriptions.forEach((s) => s.cancel())patterns. Added support for LinkedHashSet and HashSet collection types. Improved loop variable validation to prevent false negatives. Added quick fix to insert cancel() calls (handles both single and collection subscriptions, creates dispose() if missing).prefer_test_wrapper: Fixed false positive for teardown patterns whereSizedBox,Container, orPlaceholderare pumped to unmount widgets before disposing controllers. Added quick fix to wrap withMaterialApp.missing_test_assertion: Fixed duplicate tier assignment (was in both Essential and Recommended). Now correctly only in Essential tier. Added quick fix to insertexpect()placeholder.avoid_assigning_notifiers: Fixed missing visitor class causing compilation error. Added Riverpod import check to only apply to files using Riverpod. Added RHS type fallback forlate finalvariables. Added quick fix to comment out problematic assignments. Documented in using_with_riverpod.md guide.require_api_timeout: Removed duplicate rule. Merged intorequire_request_timeoutwhich has better logic (more HTTP methods, avoids apiClient false positives, handles await patterns). Old name kept as alias for migration.- tiers.dart: Added 9 missing rules that were implemented but not registered:
require_type_adapter_registration→ Essential (Hive adapter not registered)require_hive_database_close→ Professional (database resource leak)prefer_lazy_box_for_large→ Professional (Hive memory optimization)prefer_http_connection_reuse→ Professional (network performance)avoid_redundant_requests→ Professional (resource efficiency)prefer_pagination→ Professional (memory efficiency)require_cancel_token→ Professional (cancel on dispose)require_response_caching→ Comprehensive (opinionated)avoid_over_fetching→ Comprehensive (opinionated)
- test_rules.dart: Added 7 test rules to tiers that were registered but never enabled:
prefer_descriptive_test_name→ Professionalprefer_fake_over_mock→ Professionalrequire_edge_case_tests→ Professionalavoid_test_implementation_details→ Professionalprefer_test_data_builder→ Professionalprefer_test_variant→ Professionalrequire_animation_tests→ Professional
avoid_uncaught_future_errors: Fixed false positives for awaited futures. Rule now only flags fire-and-forget futures (unawaited calls). Merged duplicaterequire_future_error_handlingrule into this one (old name kept as alias). Added exceptions fordispose()methods,cancel()/close()methods, and futures inside try blocks. Added quick fix to add.catchError().require_test_cleanup: Fixed false positives from generic substring matching. Now uses specific patterns to avoid matchingcreateWidget(),insertText(),output()and similar unrelated methods. Only flags actual File/Directory operations, database inserts, and Hive box operations.require_pump_after_interaction: Fixed indexOf logic that only checked first interaction occurrence. Now tracks ALL interaction positions and checks each segment for proper pump() placement between interactions and expects.prefer_test_data_builder: Added null check forname2token access to prevent runtime errors on complex type constructs.require_hive_initialization: Changed LintImpact from medium to low since this is an informational heuristic that cannot verify cross-file initialization.- hive_rules.dart: Extracted shared
_isHiveBoxTarget()and_isHiveBoxField()utilities to reduce duplication and improve box detection accuracy. Now uses word boundary matching to avoid false positives like 'infobox' or 'checkbox'. require_error_identification: Fixed false positives from substring matching.contains('red'). Now uses regex pattern matching (colors\.red,.red\b, etc.) to avoid matching words like 'thread', 'spread', 'shredded'.- api_network_rules.dart: Added import validation for package-specific rules to prevent false positives:
avoid_dio_debug_print_production: Now checks for Dio import and uses type-based detection for LogInterceptorrequire_geolocator_timeout: Only applies to files importing geolocator packagerequire_connectivity_subscription_cancel: Only applies to files importing connectivity_plus packagerequire_notification_handler_top_level: Only applies to files importing firebase_messaging packagerequire_permission_denied_handling: Only applies to files importing permission_handler package; uses AST-based property access detection instead of string contains
- navigation_rules.dart: Added import validation for all go_router rules to prevent false positives in projects not using go_router:
avoid_go_router_inline_creationrequire_go_router_error_handlerrequire_go_router_refresh_listenableavoid_go_router_string_pathsprefer_go_router_redirect_authrequire_go_router_typed_params
- state_management_rules.dart: Fixed
prefer_context_read_in_callbacksrule to properly detect Flutter callback conventions. Now checks foronprefix followed by uppercase letter (e.g.,onPressed,onTap) to avoid false positives on words likeonce,only,ongoing. - import_utils.dart: New shared utility file for package import validation. Provides
fileImportsPackage()function andPackageImportsconstants for Dio, Geolocator, Connectivity, Firebase Messaging, Permission Handler, GoRouter, Riverpod, Hive, GetIt, Provider, Bloc, and more. Reduces code duplication across rule files.
2.2.0 - 2026-01-10 #
Added #
Pubspec Analyzer Script
scripts/analyze_pubspec.py: Python script that analyzes a Flutter project'spubspec.yamland recommends the optimal saropa_lints tier based on packages used. Features:- Recommends tier (essential/recommended/professional/comprehensive/insanity) based on dependencies
- Shows package-specific rules that will be active for your packages
- Identifies packages not yet covered by saropa_lints
- Outputs JSON report with detailed analysis
- Usage:
python scripts/analyze_pubspec.py <path_to_pubspec.yaml>
Package-Specific Rules (19 rules)
Authentication Rules (3 rules)
require_google_signin_error_handling: Warns whensignIn()call lacks try-catch error handlingrequire_apple_signin_nonce: Warns when Apple Sign-In is missingrawNonceparameter - security requirementavoid_openai_key_in_code: Warns when OpenAI API key pattern (sk-...) appears in source code
Supabase Rules (3 rules)
require_supabase_error_handling: Warns when Supabase client calls lack try-catch error handlingavoid_supabase_anon_key_in_code: Warns when Supabase anon key appears hardcoded in sourcerequire_supabase_realtime_unsubscribe: Warns when Supabase realtime channel lacks unsubscribe in dispose
WebView Security Rules (2 rules)
require_webview_ssl_error_handling: Warns when WebView lacksonSslErrorhandleravoid_webview_file_access: Warns when WebView hasallowFileAccess: trueenabled
WorkManager Rules (2 rules)
require_workmanager_constraints: Warns when WorkManager task lacks network/battery constraintsrequire_workmanager_result_return: Warns when WorkManager callback doesn't return TaskResult
Dispose Pattern Rules (3 rules)
require_keyboard_visibility_dispose: Warns when KeyboardVisibilityController subscription not disposedrequire_speech_stop_on_dispose: Warns when SpeechToText instance not stopped in disposerequire_calendar_timezone_handling: Warns when calendar events lack time zone handling
Deep Linking & Security Rules (3 rules)
avoid_app_links_sensitive_params: Warns when deep link URLs contain sensitive parameters (token, password)require_envied_obfuscation: Warns when @Envied annotation lacksobfuscate: truerequire_openai_error_handling: Warns when OpenAI API calls lack error handling
UI Component Rules (3 rules)
require_svg_error_handler: Warns when SvgPicture lackserrorBuilderparameterrequire_google_fonts_fallback: Warns when GoogleFonts lacksfontFamilyFallbackprefer_uuid_v4: Suggests using UUID v4 over v1 for better randomness
2.1.0 - 2026-01-10 #
SharedPreferences Security Rules (4 rules)
avoid_shared_prefs_sensitive_data: Warns when sensitive data (passwords, tokens) is stored in SharedPreferencesrequire_secure_storage_for_auth: Warns when auth tokens use SharedPreferences instead of flutter_secure_storagerequire_shared_prefs_null_handling: Warns when SharedPreferences getter is used with null assertionrequire_shared_prefs_key_constants: Warns when string literals are used as SharedPreferences keys
sqflite Database Rules (5 rules)
require_sqflite_whereargs: Warns when SQL queries use string interpolation - SQL injection vulnerabilityrequire_sqflite_transaction: Warns when multiple sequential writes should use transactionrequire_sqflite_error_handling: Warns when database operations lack try-catchprefer_sqflite_batch: Warns when database insert is in a loop - use batch operationsrequire_sqflite_close: Warns when database is opened but not closed in dispose
Hive Database Rules (5 rules)
require_hive_initialization: Reminds to ensure Hive.init() is called before openBox (heuristic)require_hive_type_adapter: Warns when custom object is stored in Hive without @HiveTyperequire_hive_box_close: Warns when Hive box is opened but not closed in disposeprefer_hive_encryption: Warns when sensitive data is stored in unencrypted Hive boxrequire_hive_encryption_key_secure: Warns when HiveAesCipher uses hardcoded key
Dio HTTP Client Rules (6 rules)
require_dio_timeout: Warns when Dio instance lacks timeout configurationrequire_dio_error_handling: Warns when Dio requests lack error handlingrequire_dio_interceptor_error_handler: Warns when InterceptorsWrapper lacks onError callbackprefer_dio_cancel_token: Warns when long-running Dio requests lack CancelTokenrequire_dio_ssl_pinning: Warns when Dio auth endpoints lack SSL certificate pinningavoid_dio_form_data_leak: Warns when FormData with files lacks cleanup
Stream/Future Rules (6 rules)
avoid_stream_in_build: Warns when StreamController is created in build() methodrequire_stream_controller_close: Warns when StreamController field is not closed in disposeavoid_multiple_stream_listeners: Warns when multiple listen() calls on non-broadcast streamrequire_stream_error_handling: Warns when stream.listen() lacks onError callbackavoid_future_builder_rebuild: Warns when FutureBuilder has inline future in buildrequire_future_timeout: Warns when long-running Future lacks timeout
go_router Navigation Rules (4 rules)
avoid_go_router_inline_creation: Warns when GoRouter is created inside build() methodrequire_go_router_error_handler: Warns when GoRouter lacks errorBuilderrequire_go_router_refresh_listenable: Warns when GoRouter with redirect lacks refreshListenableavoid_go_router_string_paths: Warns when string literals used in go_router navigation
Riverpod Rules (3 rules)
require_riverpod_error_handling: Warns when AsyncValue is accessed without error handlingavoid_riverpod_state_mutation: Warns when state is mutated directly in Notifierprefer_riverpod_select: Warns when ref.watch() accesses single field - use select()
cached_network_image Rules (3 rules)
require_cached_image_dimensions: Warns when CachedNetworkImage lacks cache dimensionsrequire_cached_image_placeholder: Warns when CachedNetworkImage lacks placeholderrequire_cached_image_error_widget: Warns when CachedNetworkImage lacks errorWidget
Geolocator Rules (4 rules)
require_geolocator_permission_check: Warns when location request lacks permission checkrequire_geolocator_service_enabled: Warns when location request lacks service enabled checkrequire_geolocator_stream_cancel: Warns when position stream subscription lacks cancelrequire_geolocator_error_handling: Warns when location request lacks error handling
State Management Rules (11 rules)
avoid_yield_in_on_event: Warns when yield is used in Bloc event handler (deprecated in Bloc 8.0+)prefer_consumer_over_provider_of: Warns when Provider.ofavoid_listen_in_async: Warns when context.watch() is used inside async callbackprefer_getx_builder: Warns when .obs property is accessed without Obx wrapperemit_new_bloc_state_instances: Warns when emit(state..property = x) cascade mutation is usedavoid_bloc_public_fields: Warns when Bloc has public non-final fieldsavoid_bloc_public_methods: Warns when Bloc has public methods other than add()require_async_value_order: Warns when AsyncValue.when() has wrong parameter orderrequire_bloc_selector: Warns when BlocBuilder only uses one field from stateprefer_selector: Warns when context.watchrequire_getx_binding: Warns when Get.put() is used in widget build - use Bindings
Theming Rules (3 rules)
require_dark_mode_testing: Warns when MaterialApp is missing darkTheme parameteravoid_elevation_opacity_in_dark: Warns when high elevation used without brightness checkprefer_theme_extensions: Warns when ThemeData.copyWith used for custom colors
UI/UX Rules (5 rules)
prefer_skeleton_over_spinner: Suggests skeleton loaders over CircularProgressIndicatorrequire_empty_results_state: Warns when search list lacks empty state handlingrequire_search_loading_indicator: Warns when search callback lacks loading staterequire_search_debounce: Warns when search onChanged triggers API without debouncerequire_pagination_loading_state: Warns when paginated list lacks loading indicator
Lifecycle Rules (2 rules)
avoid_work_in_paused_state: Warns when Timer.periodic runs without lifecycle handlingrequire_resume_state_refresh: Warns when didChangeAppLifecycleState handles paused but not resumed
Security Rules (4 rules)
require_url_validation: Warns when Uri.parse on variable lacks scheme validationavoid_redirect_injection: Warns when redirect URL from parameter lacks domain validationavoid_external_storage_sensitive: Warns when sensitive data written to external storageprefer_local_auth: Warns when payment/sensitive operation lacks biometric authentication
Firebase Rules (3 rules)
require_crashlytics_user_id: Warns when Crashlytics setup lacks setUserIdentifierrequire_firebase_app_check: Warns when Firebase.initializeApp lacks App Check activationavoid_storing_user_data_in_auth: Warns when setCustomClaims stores large user data
Collection/Performance Rules (4 rules)
prefer_null_aware_elements: Warns when if (x != null) x can use ?x syntaxprefer_iterable_operations: Warns when .toList() after chain in for-in is unnecessaryprefer_inherited_widget_cache: Warns when same .of(context) called 3+ times in methodprefer_layout_builder_over_media_query: Warns when MediaQuery.of in list item builder
Flutter Widget Rules (3 rules)
require_should_rebuild: Warns when InheritedWidget missing updateShouldNotifyrequire_orientation_handling: Warns when MaterialApp lacks orientation handlingrequire_web_renderer_awareness: Warns when kIsWeb check uses HTML APIs without renderer check
Image/Media Rules (4 rules)
require_exif_handling: Warns when Image.file may show photos rotatedprefer_camera_resolution_selection: Warns when CameraController uses max resolutionprefer_audio_session_config: Warns when AudioPlayer lacks audio session configrequire_image_loading_placeholder: Warns when Image.network lacks loadingBuilder
Scroll/Navigation Rules (1 rule)
require_refresh_indicator_on_lists: Warns when ListView lacks RefreshIndicator wrapper
Dialog/SnackBar Rules (2 rules)
prefer_adaptive_dialog: Warns when AlertDialog lacks adaptive stylingrequire_snackbar_action_for_undo: Warns when delete SnackBar lacks undo action
API/Network Rules (2 rules)
require_content_type_check: Warns when response parsed without Content-Type checkavoid_websocket_without_heartbeat: Warns when WebSocket lacks heartbeat/ping mechanism
Forms Rules (1 rule)
avoid_keyboard_overlap: Warns when TextField in Column may be hidden by keyboard
Location Rules (1 rule)
require_location_timeout: Warns when Geolocator.getCurrentPosition lacks timeLimit
Code Quality Rules (1 rule)
prefer_dot_shorthand: Suggests Dart 3 dot shorthand (.value) for enum values
Architecture Rules (1 rule)
avoid_touch_only_gestures: Warns when GestureDetector only handles touch gestures
Async Rules (3 rules)
require_future_wait_error_handling: Warns when Future.wait lacks eagerError: falserequire_stream_on_done: Warns when Stream.listen lacks onDone handlerrequire_completer_error_handling: Warns when Completer in try-catch lacks completeError
2.0.0 - 2026-01-10 #
Changed #
- Rule aliases: Each rule now tracks numerous aliases and alternate names, making it easier to find rules by different naming conventions (e.g.,
avoid_,prefer_,require_variants)
Fixed #
require_text_editing_controller_dispose: Fixed false positives for controllers passed in from callbacks (e.g., Autocomplete'sfieldViewBuilder). Rule now only flags controllers that are actually instantiated by the class (via inline initialization or ininitState), not those assigned from external sources.require_page_controller_dispose: Same ownership-based detection fix as above.
Added #
Riverpod Rules (8 rules)
avoid_ref_read_inside_build: Warns when ref.read() is used inside build() - use ref.watch() for reactivityavoid_ref_watch_outside_build: Warns when ref.watch() is used outside build() - causes subscription leaksavoid_ref_inside_state_dispose: Warns when ref is accessed in dispose() - ref is unavailable thereuse_ref_read_synchronously: Warns when ref.read() is called after await - cache before async gapuse_ref_and_state_synchronously: Warns when ref/state is used after await - cache before async gapavoid_assigning_notifiers: Warns when assigning to notifier variables - breaks provider contractavoid_notifier_constructors: Warns when Notifier has constructor - use build() for initializationprefer_immutable_provider_arguments: Warns when provider arguments are not final
Bloc State Management Rules (8 rules)
check_is_not_closed_after_async_gap: Warns when emit() is called after await without isClosed checkavoid_duplicate_bloc_event_handlers: Warns when multiple onprefer_immutable_bloc_events: Warns when Bloc event classes have mutable fieldsprefer_immutable_bloc_state: Warns when Bloc state classes have mutable fieldsprefer_sealed_bloc_events: Suggests using sealed keyword for event base classesprefer_sealed_bloc_state: Suggests using sealed keyword for state base classesprefer_bloc_event_suffix: Suggests Bloc event classes end with 'Event' suffixprefer_bloc_state_suffix: Suggests Bloc state classes end with 'State' suffix
Riverpod Widget Rules (2 rules)
avoid_unnecessary_consumer_widgets: Warns when ConsumerWidget doesn't use refavoid_nullable_async_value_pattern: Warns when nullable access patterns used on AsyncValue
Collection & Loop Rules (2 rules)
prefer_correct_for_loop_increment: Warns when for loop uses non-standard increment patternsavoid_unreachable_for_loop: Warns when for loop has impossible bounds
Widget Optimization Rules (4 rules)
prefer_single_setstate: Warns when multiple setState calls in same methodprefer_compute_over_isolate_run: Suggests using compute() instead of Isolate.run()prefer_for_loop_in_children: Warns when List.generate used in widget childrenprefer_container: Warns when nested decoration widgets could be Container
Flame Engine Rules (2 rules)
avoid_creating_vector_in_update: Warns when Vector2/Vector3 created in update() - GC churnavoid_redundant_async_on_load: Warns when async onLoad() has no await
Code Quality Rules (4 rules)
prefer_typedefs_for_callbacks: Suggests using typedefs for callback function typesprefer_redirecting_superclass_constructor: Suggests using super parametersavoid_empty_build_when: Warns when buildWhen always returns trueprefer_use_prefix: Suggests using 'use' prefix for custom hooks
Provider Advanced Rules (5 rules)
prefer_immutable_selector_value: Warns when mutable values used in Selectorprefer_provider_extensions: Warns when long provider access chains useddispose_provided_instances: Warns when Provider.create returns disposable without dispose callbackdispose_getx_fields: Warns when GetxController has Worker fields not disposed in onCloseprefer_nullable_provider_types: Warns when Provider type is non-nullable but create may return null
GetX Build Rules (2 rules)
avoid_getx_rx_inside_build: Warns when .obs is used inside build() - memory leaksavoid_mutable_rx_variables: Warns when Rx variables are reassigned - breaks reactivity
Internationalization Rules (4 rules)
prefer_date_format: Warns when raw DateTime methods (toIso8601String, toString) are used - use DateFormat for locale-aware formattingprefer_intl_name: Warns when Intl.message() lacks name parameter - required for translation extractionprefer_providing_intl_description: Warns when Intl.message() lacks desc parameter - helps translators understand contextprefer_providing_intl_examples: Warns when Intl.message() lacks examples parameter - helps translators with placeholders
Error Handling Rules (1 rule)
avoid_uncaught_future_errors: Warns when Future is used without error handling (catchError, onError, or try-catch)
Type Safety Rules (1 rule)
prefer_explicit_type_arguments: Warns when generic types lack explicit type arguments - prevents accidental dynamic typing
Container Widget Rules (5 rules)
prefer_sized_box_square: Warns when SizedBox(width: X, height: X) uses identical values - use SizedBox.square() insteadprefer_center_over_align: Warns when Align(alignment: Alignment.center) is used - use Center widget insteadprefer_align_over_container: Warns when Container is used only for alignment - use Align widget insteadprefer_padding_over_container: Warns when Container is used only for padding - use Padding widget insteadprefer_constrained_box_over_container: Warns when Container is used only for constraints - use ConstrainedBox insteadprefer_multi_bloc_provider: Warns when nested BlocProviders are used - use MultiBlocProvider insteadavoid_instantiating_in_bloc_value_provider: Warns when BlocProvider.value creates a new bloc - memory leak riskavoid_existing_instances_in_bloc_provider: Warns when BlocProvider(create:) returns existing variable - use .value insteadprefer_correct_bloc_provider: Warns when wrong BlocProvider variant is used for the use caseprefer_multi_provider: Warns when nested Providers are used - use MultiProvider insteadavoid_instantiating_in_value_provider: Warns when Provider.value creates a new instance - lifecycle not manageddispose_providers: Warns when Provider lacks dispose callback - resource cleanupproper_getx_super_calls: Warns when GetxController lifecycle methods don't call superalways_remove_getx_listener: Warns when GetX workers are not assigned for cleanupavoid_hooks_outside_build: Warns when Flutter hooks (use* functions) are called outside build methodsavoid_conditional_hooks: Warns when hooks are called inside conditionals (breaks hook rules)avoid_unnecessary_hook_widgets: Warns when HookWidget doesn't use any hooks - use StatelessWidget insteadextend_equatable: Warns when a class overrides operator == but doesn't use Equatablelist_all_equatable_fields: Warns when Equatable class has fields not included in propsprefer_equatable_mixin: Suggests using EquatableMixin instead of extending Equatableenum_constants_ordering: Warns when enum constants are not in alphabetical ordermissing_test_assertion: Warns when a test body has no assertions (expect, verify, etc.)avoid_async_callback_in_fake_async: Warns when async callback is used inside fakeAsync - defeats fake time controlprefer_symbol_over_key: Suggests using constant Keys instead of string literals in testsincorrect_firebase_event_name: Warns when Firebase Analytics event name doesn't follow conventionsincorrect_firebase_parameter_name: Warns when Firebase Analytics parameter name doesn't follow conventionsprefer_transform_over_container: Warns when Container only has transform - use Transform widgetprefer_action_button_tooltip: Warns when IconButton/FAB lacks tooltip for accessibilityprefer_void_callback: Suggests using VoidCallback typedef instead of void Function()avoid_functions_in_register_singleton: Warns when function is passed to registerSingleton (use registerLazySingleton)
Image & Media Rules (4 rules)
require_image_loading_placeholder: Warns when Image.network lacks loadingBuilder - improves UX during image loadrequire_media_loading_state: Warns when VideoPlayer is used without isInitialized check - prevents blank widget displayrequire_pdf_loading_indicator: Warns when PDF viewer lacks loading state handling - large PDFs need load feedbackprefer_clipboard_feedback: Warns when Clipboard.setData lacks user feedback (SnackBar/Toast) - users need confirmation
Disposal & Cleanup Rules (1 rule)
require_stream_subscription_cancel: Warns when StreamSubscription field is not cancelled in dispose() - memory leak risk
Async Safety Rules (5 rules)
avoid_dialog_context_after_async: Warns when Navigator.pop uses context after await in dialog callback - context may be invalidrequire_websocket_message_validation: Warns when WebSocket message is processed without validation/try-catchrequire_feature_flag_default: Warns when RemoteConfig is accessed without fallback value - graceful degradationprefer_utc_for_storage: Warns when DateTime is stored without .toUtc() - causes timezone inconsistenciesrequire_location_timeout: Warns when Geolocator request lacks timeout parameter - GPS can hang indefinitely
Firebase & Maps Rules (8 rules)
prefer_firestore_batch_write: Warns when multiple sequential Firestore writes should use batch operationavoid_firestore_in_widget_build: Warns when Firestore query is inside build() method - causes unnecessary readsprefer_firebase_remote_config_defaults: Warns when RemoteConfig.getInstance() used without setDefaults()require_fcm_token_refresh_handler: Warns when FCM usage lacks onTokenRefresh listener - tokens expirerequire_background_message_handler: Warns when FCM lacks top-level background handler - required for background messagesavoid_map_markers_in_build: Warns when Map Marker() is created inside build() - causes rebuildsrequire_map_idle_callback: Warns when data fetch is on onCameraMove instead of onCameraIdle - too frequentprefer_marker_clustering: Warns when many individual markers are used without clustering - performance issue
Accessibility Rules (7 rules)
require_image_description: Warns when Image lacks semanticLabel or explicit excludeFromSemanticsavoid_semantics_exclusion: Warns when excludeFromSemantics:true is used - should be justified with commentprefer_merge_semantics: Warns when Icon+Text siblings lack MergeSemantics wrapper - better screen reader UXrequire_focus_indicator: Warns when interactive widgets lack visible focus stylingavoid_flashing_content: Warns when animation flashes more than 3 times per second - seizure riskprefer_adequate_spacing: Warns when touch targets have less than 8dp spacing - accessibility guidelineavoid_motion_without_reduce: Warns when animation lacks MediaQuery.disableAnimations check - accessibility
Navigation & Dialog Rules (6 rules)
require_deep_link_fallback: Warns when deep link handler lacks error/not-found fallbackavoid_deep_link_sensitive_params: Warns when deep link contains password/token params - security riskprefer_typed_route_params: Warns when route parameters are used without type parsingrequire_stepper_validation: Warns when Stepper onStepContinue lacks validation before proceedingrequire_step_count_indicator: Warns when multi-step flow lacks progress indicatorrequire_refresh_indicator_on_lists: Warns when ListView.builder lacks RefreshIndicator wrapper
Animation Rules (5 rules)
prefer_tween_sequence: Warns when multiple chained .forward().then() should use TweenSequencerequire_animation_status_listener: Warns when one-shot animation lacks StatusListener for completionavoid_overlapping_animations: Warns when multiple transitions animate the same property (scale, opacity)avoid_animation_rebuild_waste: Warns when AnimatedBuilder wraps large widget trees (Scaffold, etc.)prefer_physics_simulation: Warns when drag-release uses animateTo instead of SpringSimulation
Platform-Specific Rules (7 rules)
avoid_platform_channel_on_web: Warns when MethodChannel is used without kIsWeb check - not available on webrequire_cors_handling: Warns when HTTP calls in web-specific files lack CORS considerationprefer_deferred_loading_web: Warns when heavy packages lack deferred import on web - improves load timerequire_menu_bar_for_desktop: Warns when desktop app lacks PlatformMenuBar - standard desktop UXavoid_touch_only_gestures: Warns when GestureDetector lacks mouse handlers on desktoprequire_window_close_confirmation: Warns when desktop app's WidgetsBindingObserver lacks didRequestAppExitprefer_native_file_dialogs: Warns when showDialog is used for file picking on desktop - use native dialogs
Testing Rules (4 rules)
require_test_cleanup: Warns when test creates files/data without tearDown cleanupprefer_test_variant: Warns when similar tests with different screen sizes should use variantrequire_accessibility_tests: Warns when widget tests lack meetsGuideline accessibility checksrequire_animation_tests: Warns when animated widget tests use pump() without duration
1.8.2 and Earlier #
For details on the initial release and versions 0.1.0 through 1.6.0, please refer to CHANGELOG_ARCHIVE.md.