saropa_lints library
Custom lint rules for Saropa codebase.
Architecture: This file is the main export and tier gateway. It exposes
allSaropaRules (full list for tooling), getRulesFromRegistry (tier-filtered
for analysis), and version/config helpers. Rule instances are created lazily
from _allRuleFactories to keep memory low when only one tier is used.
Configuration
Generate your configuration with the CLI tool:
dart run saropa_lints:init --tier comprehensive
This generates analysis_options.yaml with explicit rule lists.
See BROKEN_TIERS.md for why YAML-based tier config is not supported.
Available tiers: essential (1), recommended (2),
professional (3), comprehensive (4), pedantic (5).
You can also enable/disable individual rules in the generated file:
plugins:
saropa_lints:
diagnostics:
avoid_debug_print: false # disable a rule
no_magic_number: true # enable a rule
Classes
- AbiSpecificIntegerInvalidRule
-
dart:ffiAbiSpecificInteger subclass must follow SDK layout rules. - AbstractFieldInitializerRule
- Abstract instance field must not have an initializer (invalid Dart shape).
- AccuracyTarget
- Optional accuracy target for a rule (for documentation and tooling).
- AlwaysFailRule
- Test-only rule that always reports a lint at the start of the file.
- AlwaysRemoveGetxListenerRule
- Warns when GetX reactive workers are created without cleanup.
- AlwaysRemoveListenerRule
- Warns when a listener is added but never removed.
- AnalysisReporter
-
Writes a combined analysis report to the project's
reports/directory. - AnnotateRedeclaresRule
-
Instance member that hides a super-interface member should use
@overrideor a documentation comment explaining intent. - ArgumentMustBeNativeRule
-
Warns when
Native.addressOf(and similar FFI APIs) is called with an argument that is not annotated with@Nativeor is not a known native type. - ArgumentsOrderingRule
- Warns when named arguments in function calls are not in alphabetical order.
- AstNodeTypeRegistry
- Tracks which rules care about which AST node types.
- AvoidAbsorbPointerMisuseRule
- Warns when hardcoded Color values are used instead of theme colors.
- AvoidAccessingCollectionsByConstantIndexRule
- Warns when nullable parameters are never passed null.
- AvoidAccessingOtherClassesPrivateMembersRule
- Warns when code accesses another class's private members in the same file.
- AvoidAdjacentStringsRule
- AvoidAlwaysNullParametersRule
- Warns when only one inlining annotation is used.
- AvoidAnalyticsInBuildRule
- Warns when analytics calls are made inside build().
- AvoidAndroidCleartextTrafficRule
- Warns when HTTP (non-HTTPS) URLs are used without platform check.
- AvoidAndroidTaskAffinityDefaultRule
- Warns when multiple activities use default taskAffinity.
- AvoidAnimationInBuildRule
- Warns when AnimationController is created inside build() method.
- AvoidAnimationInLargeListRule
- Warns when animations are used inside list item builders.
- AvoidAnimationRebuildWasteRule
- Warns when AnimatedBuilder wraps too much of the widget tree.
- AvoidApiKeyInCodeRule
- Warns when API keys appear to be hardcoded in source code.
- AvoidAppLinksSensitiveParamsRule
- Warns when deep links contain sensitive parameters in URL.
- AvoidAssertInProductionRule
- Warns when assert is used for validation that should work in production.
- AvoidAssetManifestJsonRule
-
Detects usage of the removed
AssetManifest.jsonfile path. - AvoidAssigningNotifiersRule
- Warns when assigning directly to a Riverpod notifier variable.
- AvoidAssigningToStaticFieldRule
- Warns when an instance method assigns to a static field.
- AvoidAssignmentsAsConditionsRule
- Warns when an assignment is used inside a condition.
- AvoidAsyncCallbackInFakeAsyncRule
- Warns when an async callback is used inside fakeAsync.
- AvoidAsyncCallInSyncFunctionRule
- Warns when an async method is called in a sync function without await.
- AvoidAsyncInBuildRule
- Warns when build() method is marked async.
- AvoidAuthInQueryParamsRule
- Warns when auth tokens are passed in query parameters.
- AvoidAuthStateInPrefsRule
- Warns when auth tokens are stored in SharedPreferences instead of secure storage.
- AvoidAutoplayAudioRule
- Warns when autoPlay: true is set on audio/video players.
- AvoidAutoPlayMediaRule
- Warns when video or audio widgets have autoPlay: true enabled.
-
Warns when string-based
context.push/context.gois used in an auto_route project. - AvoidAutoRouteKeepHistoryMisuseRule
-
Warns when
replaceAllorpopUntilRootis used outside auth flows. - AvoidBadgeWithoutMeaningRule
- Warns when Badge shows count of 0 without hiding label.
- AvoidBarrelFilesRule
- Warns when a file only contains export statements (barrel file).
- AvoidBehaviorSubjectLastValueRule
-
Warns when
.valueis accessed on aBehaviorSubjectinside anisClosedtrue-branch. - AvoidBitwiseOperatorsWithBooleansRule
- Warns when bitwise operators are used with boolean operands.
- AvoidBlocBusinessLogicInUiRule
- Warns when Bloc contains BuildContext usage or UI dependencies.
- AvoidBlocContextDependencyRule
- Warns when BuildContext is passed to Bloc constructor.
- AvoidBlocEmitAfterCloseRule
- Warns when emit() is called without checking isClosed in async handlers.
- AvoidBlocEventInConstructorRule
- Warns when BLoC events are emitted in constructor.
- AvoidBlocEventMutationRule
- Warns when BLoC events are mutated after dispatch.
- AvoidBlocInBlocRule
- Warns when BLoCs directly call other BLoCs.
- AvoidBlockingDatabaseUiRule
- Warns when database operations are performed on the main UI thread.
- AvoidBlockingMainThreadRule
- Warns when synchronous I/O methods are called on the main isolate.
- AvoidBlocListenInBuildRule
- Warns when BlocProvider.of is used with listen:true in build method.
- AvoidBlocPublicFieldsRule
- Warns when Bloc has public non-final fields.
- AvoidBlocPublicMethodsRule
- Warns when Bloc has public methods other than add().
- AvoidBlocStateMutationRule
- Warns when Bloc state is mutated directly instead of using copyWith.
- AvoidBluetoothScanWithoutTimeoutRule
- Warns when Bluetooth scan is started without timeout parameter.
- AvoidBoolInWidgetConstructorsRule
- Warns when a widget constructor has named bool parameters (except allowlisted).
- AvoidBorderAllRule
- Warns when Hero widget is used without defining heroTag.
- AvoidBottomTypeInPatternsRule
- Warns when pattern contains bottom types (void, Never, Null).
- AvoidBottomTypeInRecordsRule
- Warns when record contains bottom types (void, Never, Null).
- AvoidBrightnessCheckForThemeRule
- Warns when AbsorbPointer is used (often IgnorePointer is more appropriate).
- AvoidBuildContextInProvidersRule
- Future rule: avoid-build-context-in-providers
- AvoidBuilderIndexOutOfBoundsRule
- Warns when Expanded or Flexible is used outside Row, Column, or Flex.
- AvoidBusinessLogicInUiRule
- Warns when business logic is in UI layer.
- AvoidCachedImageInBuildRule
- Warns when CachedNetworkImage uses a variable cacheKey in build.
- AvoidCachedImageUnboundedListRule
- Warns when CachedNetworkImage is used in a ListView without cache bounds.
- AvoidCachedImageWebRule
-
Warns when CachedNetworkImage is used inside a
kIsWebtrue-branch. - AvoidCachedIsarStreamRule
- Warns when Isar (or other single-subscription) streams are incorrectly cached or reused.
- AvoidCacheStampedeRule
- Warns when an async method uses a Map cache without in-flight dedup.
- AvoidCallingOfInBuildRule
- Warns when Theme.of or MediaQuery.of is called multiple times in build.
- AvoidCanvasInBuildRule
- Warns when Canvas operations are used outside of CustomPainter.
- AvoidCapturingThisInCallbacksRule
- Warns when closures capture more context than needed.
- AvoidCascadeAfterIfNullRule
- Warns when cascade is used after if-null operator without parentheses.
- AvoidCascadesRule
- Discourages use of cascade notation (..) for clarity and maintainability.
- AvoidCaseSensitivePathComparisonRule
- Detects file path comparisons that don't account for case insensitivity.
- AvoidCastingToExtensionTypeRule
- Warns when casting to an extension type.
- AvoidCatchAllRule
- Warns when using bare catch without an on clause.
- AvoidCatchExceptionAloneRule
-
Warns when
on Exception catchis used withouton Object catchfallback. - AvoidCatchingGenericExceptionRule
- Future rule: avoid-catching-generic-exception
- AvoidChangeNotifierInWidgetRule
- Warns when ChangeNotifier is created inside build().
- AvoidChipDeleteInkWellCircleBorderRule
-
Flags
InkWellwith a circularcustomBorderon chipdeleteIconvalues. - AvoidCircularDependenciesRule
- Warns when circular dependencies are detected.
- AvoidCircularDiDependenciesRule
- Warns when circular dependencies are detected in DI registration.
- AvoidCircularImportsRule
- Detects circular import dependencies between files.
- AvoidCircularProviderDepsRule
- Warns when Riverpod providers reference each other in a cycle.
- AvoidCircularRedirectsRule
- Warns when route redirects could create infinite loops.
- AvoidClassesWithOnlyStaticMembersRule
- Warns when a class has only static members (and optionally a private constructor).
- AvoidClearingFormOnErrorRule
- Warns when forms clear input on validation error.
- AvoidClipboardSensitiveRule
- Warns when sensitive data is copied to clipboard.
- AvoidClipDuringAnimationRule
- Warns when a Clip widget is used inside an animated widget.
- AvoidClosureCaptureLeaksRule
-
Warns when
setStateis called inside a Timer or Future.delayed callback without amountedcheck. - AvoidClosureMemoryLeakRule
- Warns when closures capture widget references causing memory leaks.
- AvoidCollapsibleIfRule
- Warns when nested if statements can be collapsed into one.
- AvoidCollectionEqualityChecksRule
- Warns when comparing collections using == operator.
- Warns when using collection methods with unrelated types.
- AvoidCollectionMutatingMethodsRule
-
Warns when collections are mutated in-place inside
setState(). - AvoidColorOnlyIndicatorsRule
- Warns when using color alone to convey information.
- AvoidColorOnlyMeaningRule
- Warns when color is the sole visual means of conveying meaning.
- AvoidCommentedOutCodeRule
- Warns when commented-out code is detected.
- AvoidComplexArithmeticExpressionsRule
- Warns when arithmetic expressions are too complex.
- AvoidComplexConditionsRule
- Warns when conditions are too complex.
- AvoidComplexLoopConditionsRule
- AvoidConditionalHooksRule
- Warns when Flutter Hooks are called inside conditionals.
- AvoidConditionsWithBooleanLiteralsRule
- Warns when boolean literals are used in logical expressions.
- AvoidConnectivityEqualsInternetRule
-
Warns when
ConnectivityResultis used as a proxy for internet access. - AvoidConstantAssertConditionsRule
- Warns when assert has a constant condition (always true or always false).
- AvoidConstantConditionsRule
- Warns when both sides of a binary expression are constants.
- AvoidConstantSwitchesRule
- Warns when switch statement has a constant expression.
- AvoidContextAcrossAsyncRule
- Warns when BuildContext is used after an await without a mounted check.
- AvoidContextAfterAwaitInStaticRule
-
Quick fix that inserts
if (!mounted) return;before context usage. Warns when BuildContext is used after await in async static methods. - Warns when BuildContext is used after an await in navigation.
- AvoidContextDependencyInCallbackRule
- Warns when BuildContext-dependent calls (Theme.of, MediaQuery.of,
- AvoidContextInAsyncStaticRule
- Warns when BuildContext parameter is used in async static methods.
- AvoidContextInInitStateDisposeRule
- AvoidContextInStaticMethodsRule
- Quick fix that adds an isMounted callback parameter after BuildContext. Warns when BuildContext is used in any static method.
- AvoidContinueRule
- Warns when the continue statement is used.
- AvoidContinuousLocationUpdatesRule
- Warns when continuous location updates are used without need.
- AvoidContradictoryExpressionsRule
- Warns when loop conditions are too complex.
- AvoidControllerInBuildRule
- Warns when ScrollController is created in build method.
- AvoidCreatingVectorInUpdateRule
- Warns when Vector2/Vector3 objects are created inside update().
- AvoidCrossFeatureDependenciesRule
- Warns when feature module has external dependencies.
- AvoidCubitsRule
- Prefer Bloc over Cubit for better event traceability.
- AvoidDatabaseInBuildRule
- Warns when database operations are performed directly in widget build.
- AvoidDatetimeComparisonWithoutPrecisionRule
- Warns when DateTime values are compared using == or !=.
- AvoidDatetimeNowInTestsRule
- Warns when DateTime.now() is used in test files.
- AvoidDateTimeParseUnvalidatedRule
- Warns when DateTime.parse is used without try-catch or tryParse.
- AvoidDebugPrintRule
- Warns when debugPrint is used.
- AvoidDeclaringCallMethodRule
- Warns when a class declares a call() method.
- AvoidDeepLinkSensitiveParamsRule
- AvoidDeeplyNestedWidgetsRule
- Future rule: avoid-deeply-nested-widgets
- AvoidDeepNestingRule
- Warns when code blocks are nested more than 5 levels deep.
- AvoidDeepWidgetNestingRule
- Warns when shrinkWrap: true is used on scrollable widgets.
- AvoidDefaultToStringRule
- Warns when a class doesn't override toString().
- AvoidDeprecatedAnimatedListTypedefsRule
-
Flags deprecated
AnimatedListItemBuilderandAnimatedListRemovedItemBuildertypedefs (Flutter 3.7, PR #113131). - AvoidDeprecatedCryptoAlgorithmsRule
- Warns when deprecated cryptographic algorithms are used.
- AvoidDeprecatedExpiresGetterRule
-
Detects use of the removed
Deprecated.expiresgetter (Dart 3.0). - AvoidDeprecatedFileSystemDeleteEventIsDirectoryRule
-
Flags use of
FileSystemDeleteEvent.isDirectory(deprecated in Dart 3.4). - AvoidDeprecatedFlutterTestWindowRule
-
Flags deprecated
TestWindowandTestWidgetsFlutterBinding.windowfrompackage:flutter_test. - AvoidDeprecatedHasNextIteratorRule
-
Flags deprecated HasNextIterator from
dart:collection(Dart 3.0+). - AvoidDeprecatedListConstructorRule
-
Detects the removed null-unsafe
List()unnamed constructor (Dart 3.0). - AvoidDeprecatedNetworkInterfaceListSupportedRule
-
Flags deprecated NetworkInterface.listSupported (
dart:io). - AvoidDeprecatedOnSurfaceDestroyedRule
-
Flags deprecated
SurfaceProducer.onSurfaceDestroyed(Flutter 3.29, PR #160937). - AvoidDeprecatedPointerArithmeticRule
-
Flags deprecated
Pointer.elementAt()andPointer.offsetBy()in dart:ffi. - AvoidDeprecatedUsageRule
- Warns when using deprecated APIs from other packages (WARNING severity).
- AvoidDeprecatedUseInheritedMediaQueryRule
-
Flags usage of the deprecated
useInheritedMediaQueryparameter. - AvoidDeprecatedUseMaterial3CopyWithRule
-
Flags
useMaterial3parameter inThemeData.copyWith()(Flutter 3.16, PR #131455). - AvoidDialogContextAfterAsyncRule
- Warns when Navigator.pop or context is used after await in a dialog callback.
- AvoidDialogInBuildRule
- Warns when showDialog is called inside build().
- AvoidDigitSeparatorsRule
- Warns when digit separators are used unnecessarily.
- AvoidDiInWidgetsRule
- Widgets should get dependencies via InheritedWidget/Provider, not GetIt.
- AvoidDioDebugPrintProductionRule
- Warns when Dio debug logging is enabled without kDebugMode check.
- AvoidDioFormDataLeakRule
- Warns when FormData with files is not properly cleaned up.
- AvoidDioWithoutBaseUrlRule
- Warns when Dio is used without baseUrl.
- AvoidDirectDataAccessInUiRule
- Warns when UI layer directly accesses data layer.
- AvoidDoubleAndIntChecksRule
-
Warns when combining
is intandis doublechecks on the same expression. - AvoidDoubleForMoneyRule
- Warns when double is used for money/currency values.
- AvoidDoubleSlashImportsRule
- Warns when double slashes are used in import paths.
- AvoidDoubleTapSubmitRule
- Warns when buttons don't prevent double-tap submissions.
- AvoidDriftCloseStreamsInTestsRule
- Warns when NativeDatabase.memory() is used in tests without closeStreamsSynchronously.
- AvoidDriftDatabaseOnMainIsolateRule
- Warns when NativeDatabase is created without background isolate support.
- AvoidDriftEnumIndexReorderRule
-
Warns when Drift TypeConverter uses enum
.indexfor int storage. - AvoidDriftForeignKeyInMigrationRule
- Warns when PRAGMA foreign_keys is set inside a migration callback.
- AvoidDriftGetSingleWithoutUniqueRule
- Warns when getSingle/watchSingle is used without a where() clause.
- AvoidDriftLazyDatabaseRule
- Warns when LazyDatabase is used with isolate-based patterns.
- AvoidDriftLogStatementsProductionRule
- Warns when logStatements is set to true without a debug mode guard.
- AvoidDriftMissingUpdatesParamRule
-
Warns when
customUpdateorcustomInsertis missing theupdatesparameter. - AvoidDriftNullableConverterMismatchRule
- Warns when a TypeConverter has both nullable type parameters.
- AvoidDriftQueryInMigrationRule
- Warns when high-level Drift query APIs are used in migration callbacks.
- AvoidDriftRawSqlInterpolationRule
- Warns when raw SQL methods use string interpolation or concatenation.
- AvoidDriftReplaceWithoutAllColumnsRule
-
Warns when
.replace()is used on a Drift update builder. - AvoidDriftUnsafeWebStorageRule
- Warns when unsafe web storage modes are used with Drift.
- AvoidDriftUpdateWithoutWhereRule
- Warns when Drift update() or delete() is used without a where() clause.
- AvoidDriftValidateSchemaProductionRule
-
Warns when
validateDatabaseSchema()is called without a debug guard. - AvoidDriftValueNullVsAbsentRule
-
Warns when
Value(null)is used in a Drift Companion, which may crash on non-nullable columns or silently differ fromValue.absent(). - AvoidDuplicateBlocEventHandlersRule
- Warns when multiple handlers are registered for the same event type.
- AvoidDuplicateCascadesRule
- Warns when the same cascade operation is performed multiple times.
- AvoidDuplicateConstantValuesRule
- Warns when the same constant value is defined multiple times.
- AvoidDuplicateExportsRule
- Warns when the same file is exported multiple times.
- AvoidDuplicateInitializersRule
- Warns when the same initializer expression is used twice.
- AvoidDuplicateMapKeysRule
- Warns when duplicate keys are used in a map literal.
- AvoidDuplicateMixinsRule
- Warns when the same mixin is applied multiple times in a class hierarchy.
- AvoidDuplicateNamedImportsRule
- Warns when the same import is declared with different prefixes.
- AvoidDuplicateNumberElementsRule
- Warns when duplicate numeric elements appear in collection literals.
- AvoidDuplicateObjectElementsRule
- Warns when duplicate object elements appear in collection literals.
- AvoidDuplicatePatternsRule
- Warns when isEmpty/isNotEmpty is used after where().
- AvoidDuplicateStringElementsRule
- Warns when duplicate string elements appear in collection literals.
- AvoidDuplicateStringLiteralsPairRule
- Warns when the same string literal appears 2 or more times in a file.
- AvoidDuplicateStringLiteralsRule
- Warns when a late local variable is initialized immediately.
- AvoidDuplicateSwitchCaseConditionsRule
- Warns when switch case has duplicate conditions.
- AvoidDuplicateTestAssertionsRule
- Warns when duplicate test assertions are made.
- AvoidDuplicateWidgetKeysRule
- Future rule: avoid-duplicate-keys-in-widget-list
- AvoidDynamicCodeLoadingRule
- Warns when code is loaded dynamically at runtime, bypassing compile-time
- AvoidDynamicJsonAccessRule
- Detects chained JSON access without null checks.
- AvoidDynamicJsonChainsRule
- Detects deeply chained JSON access patterns.
- AvoidDynamicRule
- Warns when dynamic type is used.
- AvoidDynamicSqlRule
- Warns when passwords are stored in SharedPreferences.
- AvoidElevationOpacityInDarkRule
- Warns when Card or Material uses elevation without checking brightness.
- AvoidEmptyBuildWhenRule
- Suggests using typedefs for callback function types.
- AvoidEmptySetStateRule
-
Warns when a setState callback body is empty without a
mountedguard. - AvoidEmptySpreadRule
- Warns when an empty spread is used.
- AvoidEmptyTestGroupsRule
- Warns when a test group() has an empty body.
- AvoidEmptyTextWidgetsRule
- Future rule: prefer-opacity-over-color-alpha
- AvoidEncryptionKeyInMemoryRule
- Warns when encryption keys are stored as class fields.
- AvoidEntitlementWithoutServerRule
- Warns when IAP purchase status is checked client-side without server verification.
- AvoidEnumValuesByIndexRule
-
Warns when accessing enum values by index (
EnumName.values[i]). - AvoidEqualExpressionsRule
- Warns when comparing an expression to itself (x == x).
- AvoidEquatableDatetimeRule
- DateTime equality is problematic due to microsecond precision.
- AvoidEquatableNestedEqualityRule
-
Warns when an Equatable class includes mutable collections in
props. - AvoidEscapingInnerQuotesRule
- Warns when a string literal uses escaped inner quotes that could be avoided by switching delimiters.
- AvoidEvalLikePatternsRule
- Warns when biometric authentication lacks a fallback mechanism.
- AvoidExceptionInConstructorRule
- Warns when constructors throw exceptions.
- Warns when BottomNavigationBar has more than 5 items.
- AvoidExcessiveExpressionsRule
- Warns when an expression has excessive complexity.
- AvoidExcessiveRebuildsAnimationRule
- Warns when animation builder callbacks contain too many widgets.
- AvoidExcessiveWidgetDepthRule
- Warns when widget tree depth is excessive.
- AvoidExistingInstancesInBlocProviderRule
-
Warns when
BlocProvider(create: ...)returns an existing bloc instance. - AvoidExpandedAsSpacerRule
- AvoidExpandedOutsideFlexRule
- Warns when Stack children are not wrapped in Positioned or Align.
- AvoidExpandoCircularReferencesRule
- Warns when Expando is used without understanding its memory implications.
- AvoidExpensiveBuildRule
- Warns when expensive operations are performed in build methods.
- AvoidExpensiveComputationInBuildRule
- Warns when expensive computations are performed in build method.
- AvoidExpensiveDidChangeDependenciesRule
-
Warns when expensive operations run inside
didChangeDependencies(). - AvoidExpensiveLogStringConstructionRule
- Don't build expensive strings for logs that won't print.
- AvoidExplicitPatternFieldNameRule
- Warns when explicit field names are used in pattern matching
- AvoidExplicitTypeDeclarationRule
- Warns when local or top-level variable has explicit type that could be inferred.
- AvoidExtendingHtmlNativeClassRule
-
Flags extending native
dart:htmlclasses that can no longer be subclassed. - AvoidExtendingSecurityContextRule
-
Flags extending
SecurityContextwhich is nowfinalin Dart 3.5. - AvoidExtensionsOnRecordsRule
- Warns when extension is defined on a Record type.
- AvoidExternalStorageSensitiveRule
- Warns when sensitive data is written to external storage.
- AvoidFieldInitializersInConstClassesRule
- Warns when a class with a const constructor has instance fields with inline initializers that should be in the initializer list.
- AvoidFinalizerMisuseRule
- Warns when Dart Finalizers are misused.
- AvoidFindAllRule
- Warns when find.byType() is used without a specific type.
- AvoidFindByTextRule
- Suggests find.byKey() over find.text() for interactive widgets.
- AvoidFindChildInBuildRule
- Warns when GestureDetector doesn't handle long press for context menus.
- AvoidFirebaseRealtimeInBuildRule
- Don't create Firebase listeners in build method.
- AvoidFirebaseUserDataInAuthRule
- Warns when too much user data is stored in Firebase Auth custom claims.
- AvoidFirestoreInWidgetBuildRule
- Warns when Firestore operations are performed in widget build method.
- AvoidFirestoreUnboundedQueryRule
- Warns when Firestore query doesn't have a limit.
- AvoidFittedBoxForTextRule
- Warns when FittedBox contains a Text widget.
- AvoidFixedDimensionsRule
- Warns when SizedBox or Container uses fixed pixel dimensions.
- AvoidFixedSizeInScaffoldBodyRule
-
Warns when a
Scaffoldbody contains aColumnwithTextField - AvoidFlakyTestsRule
- Warns when tests contain patterns that cause flakiness.
- AvoidFlashingContentRule
- Warns when repeating animation may flash more than 3 times per second.
- AvoidFlexibleOutsideFlexRule
- Warns when Flexible or Expanded is used outside of a Flex widget.
- AvoidFontWeightAsNumberRule
- Warns when FontWeight is specified using numeric w-values instead of named constants.
- AvoidFormInAlertDialogRule
- Warns when Form is used inside AlertDialog or SimpleDialog.
- AvoidFormValidationOnChangeRule
-
Warns when
validate()is called inside anonChangedcallback. - AvoidFormWithoutKeyRule
- Future rule: avoid-form-without-key
- AvoidFormWithoutUnfocusRule
- Warns when forms don't unfocus after submission.
- AvoidForwardSlashPathAssumptionRule
-
Detects path construction using
/concatenation instead ofpath.join(). - AvoidFreezedAnyMapIssueRule
-
Warns when a
@freezedclass withfromJsonlacks@JsonSerializable(anyMap: true). - AvoidFreezedForLogicClassesRule
- Warns when Freezed is used for logic classes like Blocs or Services.
- AvoidFreezedInvalidAnnotationTargetRule
- Warns when @freezed is used on a non-class declaration.
- AvoidFreezedJsonSerializableConflictRule
- Warns when both @freezed and @JsonSerializable are used on same class.
- AvoidFullSyncOnEveryLaunchRule
- Warns when bulk data fetching is performed inside initState.
- AvoidFunctionLiteralsInForeachCallsRule
- Warns when .forEach() is called with a function literal instead of a for-in loop.
- AvoidFunctionsInRegisterSingletonRule
- Warns when a function literal is passed to registerSingleton.
- AvoidFunctionTypeInRecordsRule
- Warns when Function type is used in record definitions.
- AvoidFutureIgnoreRule
- Warns when calling .ignore() on a Future.
- AvoidFutureInBuildRule
- Warns when Future is created inside build() method.
- AvoidFutureThenInAsyncRule
- Warns when .then() is used inside an async function.
- AvoidFutureToStringRule
- Warns when calling toString() or using string interpolation on a Future.
- AvoidGenericExceptionsRule
- Warns when using generic Exception instead of specific types.
- AvoidGenericKeyInUrlRule
- Warns when generic key/auth parameters appear in URLs (pedantic tier).
- AvoidGenericsShadowingRule
- Warns when a generic type parameter shadows a top-level declaration.
- AvoidGestureConflictRule
- Warns when buttons with conditional onPressed don't customize disabled style.
- AvoidGestureDetectorInScrollViewRule
- Future rule: avoid-singlechildscrollview-with-column
- AvoidGestureOnlyInteractionsRule
- Warns when GestureDetector is used without keyboard accessibility.
- AvoidGestureWithoutBehaviorRule
- Warns when Text widgets with dynamic content lack overflow handling.
- AvoidGetFindInBuildRule
- Warns when Get.find() is used inside build() method.
- AvoidGetItInBuildRule
- Warns when GetIt.I or GetIt.instance is used inside build().
- AvoidGetterPrefixRule
- Warns when a getter name starts with 'get'.
- AvoidGetxBuildContextBypassRule
- Warns when Get.context is used to bypass Flutter's BuildContext mechanism.
- AvoidGetxContextOutsideWidgetRule
- Warns when Get.context, Get.overlayContext, or similar is used outside widget classes.
- AvoidGetxDialogSnackbarInControllerRule
- Warns when Get.snackbar or Get.dialog is called in GetxController.
- Get.to() uses global context, hurting testability.
- AvoidGetxGlobalStateRule
- Warns when GetX global state is used instead of reactive state.
- AvoidGetxRxInsideBuildRule
- Warns when .obs is used inside build() method.
- AvoidGetxRxNestedObsRule
-
Warns when GetX reactive observables are nested (e.g.
Rx<List<RxInt>>). - AvoidGetxStaticContextRule
- Warns when GetX static context methods are used.
- AvoidGetxStaticGetRule
- Warns when Get.find() is used for dependency lookup instead of
- AvoidGlobalKeyInBuildRule
- Warns when GlobalKey is created in build method.
- AvoidGlobalKeyMisuseRule
- Warns when GlobalKey is overused or misused.
- AvoidGlobalKeysInStateRule
- GlobalKey fields created in StatefulWidget persist across hot reload.
- AvoidGlobalRiverpodProvidersRule
- Warns when Riverpod providers are not properly scoped.
- AvoidGlobalStateRule
- Warns when mutable global state is declared.
- AvoidGodClassRule
- Warns when God class is detected (too many responsibilities).
- AvoidGoRouterInlineCreationRule
- Warns when GoRouter is created inline in build() method.
- AvoidGoRouterPushReplacementConfusionRule
- Warns about potential confusion between go() and push() in GoRouter.
- AvoidGoRouterStringPathsRule
- Warns when string literals are used in go_router navigation.
- AvoidGradientInBuildRule
- Warns when Gradient objects are created inside build().
- AvoidGraphqlStringQueriesRule
- Warns when GraphQL queries are written as raw string literals.
- AvoidHardcodedApiUrlsRule
- Warns when API endpoint URLs are hardcoded.
- AvoidHardcodedAppNameRule
- Warns when app name or branding is hardcoded.
- AvoidHardcodedAssetPathsRule
- Future rule: avoid-hardcoded-asset-paths
- AvoidHardcodedColorsRule
- Warns when Color values are hardcoded instead of using theme colors.
- AvoidHardcodedConfigRule
- Warns when hardcoded configuration values are detected.
- AvoidHardcodedConfigTestRule
- Detects hardcoded configuration values in test files at reduced severity.
- AvoidHardcodedCredentialsRule
- Warns when hardcoded credentials are detected in source code.
- AvoidHardcodedDelaysRule
- Warns when Future.delayed is used with hardcoded duration in tests.
- AvoidHardcodedDriveLettersRule
- Detects hardcoded Windows drive letter paths in string literals.
- AvoidHardcodedDurationRule
- Warns when Duration uses hardcoded literal values instead of constants.
- AvoidHardcodedEncryptionKeysRule
- Warns when encryption keys appear to be hardcoded.
- AvoidHardcodedFeatureFlagsRule
- Warns when hardcoded feature flags (if true/false) are used.
- AvoidHardcodedLayoutValuesRule
- Warns when Material 2 is explicitly enabled via useMaterial3: false.
- AvoidHardcodedLocaleRule
- Warns when locale is hardcoded instead of using device locale.
- AvoidHardcodedLocaleStringsRule
- User-visible strings should use localization.
- AvoidHardcodedSigningConfigRule
- Warns when signing configuration (keystore paths, passwords, aliases)
- AvoidHardcodedStringsInUiRule
- Warns when hardcoded user-facing strings are detected.
- AvoidHardcodedTestDelaysRule
- Warns when test has hardcoded delays.
- AvoidHardcodedTextStylesRule
- Warns when interactive widgets don't handle hover state.
- AvoidHardcodedUnixPathsRule
-
Detects hardcoded Unix filesystem paths that should use
path_provider. - AvoidHiddenInteractiveRule
- Warns when interactive elements have excludeFromSemantics but also have tap handlers.
- AvoidHighCyclomaticComplexityRule
- Warns when a function or method has high cyclomatic complexity.
- AvoidHiveBinaryStorageRule
- Quick fix for PreferHiveLazyBoxRule.
- AvoidHiveBoxNameCollisionRule
- Warns when duplicate Hive box names are used.
- AvoidHiveDatetimeLocalRule
- Warns when storing DateTime in Hive without converting to UTC first.
- AvoidHiveFieldIndexReuseRule
- Warns when @HiveField indices are reused within the same class.
- AvoidHiveLargeSingleEntryRule
- Warns when storing large objects as a single Hive entry.
- AvoidHiveSynchronousInUiRule
- Warns when synchronous Hive box operations (get, put, delete, add) are
- AvoidHiveTypeModificationRule
- Warns when @HiveType fields have duplicate @HiveField indices.
- AvoidHooksOutsideBuildRule
- Warns when Flutter Hooks are called outside of a build method.
- AvoidHoverOnlyRule
- Warns when MouseRegion or Listener is used without tap alternative.
- AvoidIconButtonsWithoutTooltipRule
- Warns when IconButton is used without a tooltip for accessibility.
- AvoidIconSizeOverrideRule
- Warns when Icon widget has explicit size override.
- AvoidIdenticalExceptionHandlingBlocksRule
- Warns when catch blocks have identical bodies.
- AvoidIfWithManyBranchesRule
- Warns when an if statement has too many branches.
- AvoidIgnoringReturnValuesRule
- Warns when a function's return value is ignored.
- AvoidIgnoringSslErrorsRule
- Warns when sensitive data is stored in unencrypted storage.
- AvoidImageButtonsWithoutTooltipRule
- Warns when image-based buttons lack tooltips.
- AvoidImagePickerLargeFilesRule
- Warns when pickImage is called without imageQuality for compression.
- AvoidImagePickerQuickSuccessionRule
- Warns when pickImage or pickVideo is called without debounce protection.
- AvoidImagePickerWithoutSourceRule
- Warns when ImagePicker is used without specifying source.
- AvoidImageRebuildOnScrollRule
- Warns when Image.network is used inside ListView.builder without caching.
- AvoidImageRepeatRule
- Warns when ImageRepeat is used on Image widgets.
- AvoidImageWithoutCacheRule
- Future rule: prefer-widget-state-mixin
- AvoidImmediatelyInvokedFunctionsRule
- Warns when a function is immediately invoked after definition.
- AvoidImplicitAnimationDisposeCastRule
-
Flags
(animation as CurvedAnimation).dispose()inImplicitlyAnimatedWidgetStatesubclasses. - AvoidImplicitlyNullableExtensionTypesRule
- Warns when extension type doesn't implement Object and is implicitly nullable.
- AvoidImportingEntrypointExportsRule
- Warns when importing from a file that re-exports the entry point.
- AvoidIncompleteCopyWithRule
- Warns when a copyWith method is missing fields.
- AvoidInconsistentDigitSeparatorsRule
- Warns when digit separators are not grouped consistently.
- AvoidIncorrectImageOpacityRule
- AvoidIncorrectUriRule
- Warns when Uri constructor is called with an invalid URI string.
- AvoidInferrableTypeArgumentsRule
- Warns when a class field is never assigned a value.
- AvoidInfiniteScrollDuplicateRequestsRule
- Warns when scroll listeners load data without a loading guard.
- AvoidInheritedWidgetInInitStateRule
- Future rule: avoid-image-without-cache-headers
- AvoidInstantiatingInBlocValueProviderRule
-
Warns when
BlocProvider.valuereceives a newly created bloc instance. - AvoidInstantiatingInValueProviderRule
-
Warns when
Provider.valuereceives a newly created instance. - AvoidInternalDependencyCreationRule
- Warns when dependencies are created inside the class instead of injected.
- AvoidInvertedBooleanChecksRule
- Warns when an inverted boolean check is used.
- AvoidIos13DeprecationsRule
- AvoidIosBatteryDrainPatternsRule
- Warns when code patterns may cause excessive battery drain.
- AvoidIosContinuousLocationTrackingRule
- Warns when Core Location continuous tracking may drain battery.
- AvoidIosDebugCodeInReleaseRule
- Warns when iOS debug code may be included in release builds.
- AvoidIosDeprecatedUikitRule
- Warns when deprecated UIKit APIs are used in platform channel code.
- AvoidIosForceUnwrapInCallbacksRule
- Warns when force unwrapping in MethodChannel callbacks may cause crashes.
- AvoidIosHardcodedBundleIdRule
- Warns when Keychain is used without specifying accessibility level.
- AvoidIosHardcodedDeviceModelRule
- Warns when hardcoded iOS device model strings (e.g. iPhone, iPad) are detected.
- AvoidIosHardcodedKeyboardHeightRule
- Reminds about iOS Quick Note feature compatibility.
- AvoidIosHardcodedStatusBarRule
- Quick fix that wraps Scaffold body with SafeArea. Warns when hardcoded iOS status bar height values are used.
- AvoidIosInAppBrowserForAuthRule
- Warns when apps use advertising/tracking without App Tracking Transparency.
- AvoidIosMisleadingPushNotificationsRule
- Warns when iOS biometric authentication may need fallback.
- AvoidIosSimulatorOnlyCodeRule
- Warns when iOS Simulator-only code patterns are detected.
- AvoidIosWifiOnlyAssumptionRule
- Warns when code assumes WiFi-only connectivity.
- AvoidIsarClearInProductionRule
-
Warns when
Isar.clear()is called without a debug mode guard. - AvoidIsarEmbeddedLargeObjectsRule
- Warns when large objects are embedded in Isar collections.
- AvoidIsarEnumFieldRule
-
Warns when enum types are used directly as fields in Isar
@collectionclasses. - AvoidIsarFloatEqualityQueriesRule
- Warns when using equalTo() on double/float fields.
- AvoidIsarImportWithDriftRule
- Warns when a file imports both Isar and Drift packages.
- AvoidIsarSchemaBreakingChangesRule
- Warns about potential Isar schema breaking changes.
- AvoidIsarStringContainsWithoutIndexRule
- Warns when string contains() is used without a full-text index.
- AvoidIsarTransactionNestingRule
- Warns when writeTxn is called inside another writeTxn.
- AvoidIsarWebLimitationsRule
- Warns when Isar sync APIs are used on web platform.
- AvoidJsonEncodeInBuildRule
- Warns when jsonEncode is called inside build().
- AvoidJsonInMainRule
- Warns when jsonDecode is called on main thread without isolate.
- AvoidJsRoundedIntsRule
- Warns when integer literals exceed the JavaScript safe integer range (2^53).
- AvoidJwtDecodeClientRule
- Warns when JWT is decoded on client for authorization decisions.
- AvoidKeyboardOverlapRule
- Warns when TextField at bottom of screen doesn't handle keyboard overlap.
- AvoidKeywordsInWildcardPatternRule
- Warns when wildcard patterns use Dart keywords.
- AvoidLargeBlocRule
- Warns when a Bloc class has too many event handlers.
- AvoidLargeImagesInMemoryRule
- Warns when large images are loaded without size constraints.
- AvoidLargeIsolateCommunicationRule
- Warns when isolate communication sends large objects.
- AvoidLargeListCopyRule
- Warns when List.from() or toList() copies large collections.
- AvoidLargeObjectsInStateRule
- Warns when large objects are stored in widget state.
- AvoidLateContextRule
- Warns when Expanded with empty child is used instead of Spacer.
- AvoidLateFinalReassignmentRule
- AvoidLateForNullableRule
- Warns when late is used for a value that could simply be nullable.
- AvoidLateKeywordRule
- Warns when late keyword is used.
- AvoidLateWithoutGuaranteeRule
- Warns when TextFormField is used without a Form ancestor.
- AvoidLayoutBuilderInScrollableRule
- Warns when FileImage is used for bundled assets instead of AssetImage.
- AvoidLayoutBuilderMisuseRule
- Future rule: avoid-scaffold-messenger-of-context
- AvoidLayoutPassesRule
- Warns when IntrinsicWidth or IntrinsicHeight is used.
- AvoidListenInAsyncRule
- Warns when context.watch() is used inside async callback.
- AvoidListViewChildrenForLargeListsRule
- Warns when ListView uses children property with many items.
- AvoidListViewWithoutItemExtentRule
- Warns when ListView.builder or ListView.separated omits scroll extent hints.
- AvoidLoadingFlashRule
- Warns when loading states may cause a visible flash.
- AvoidLoadingFullPdfInMemoryRule
- Warns when PDF files are loaded entirely into memory without streaming.
- AvoidLocalFunctionsRule
- Warns when local functions are declared inside other functions.
- AvoidLoggingSensitiveDataRule
- AvoidLongEventHandlersRule
- Warns when Bloc event handlers are too long.
- AvoidLongFilesRule
- OPINIONATED: Flags files exceeding 500 lines.
- AvoidLongFunctionsRule
- Warns when a function or method body exceeds the maximum line count.
- AvoidLongParameterListRule
- Warns when a function has too many parameters (max 5).
- AvoidLongRecordsRule
- Warns when a record type has too many fields.
- AvoidLongRunningIsolatesRule
- Warns when background tasks may exceed iOS 30-second limit.
- AvoidLongTestFilesRule
- OPINIONATED: Flags test files exceeding 1000 lines.
- AvoidLosingStackTraceRule
- Warns when stack trace is lost in catch block.
- AvoidMacosCatalystUnsupportedApisRule
- Warns when Mac Catalyst unsupported APIs may be used.
- AvoidMacosDeprecatedSecurityApisRule
- Warns when deprecated macOS Security framework APIs are used.
- AvoidMacosFullDiskAccessRule
- Warns when macOS app may need Full Disk Access alternatives.
- AvoidMacosHardenedRuntimeViolationsRule
- Warns when code may violate macOS Hardened Runtime requirements.
- AvoidManualDateFormattingRule
- Quick fix for RequireNumberFormatLocaleRule.
- AvoidMapKeysContainsRule
- Warns when .keys.contains() is used instead of .containsKey().
- AvoidMapMarkersInBuildRule
- Warns when map markers are created in build method.
- AvoidMaterial2FallbackRule
- Warns when Row/Column uses SizedBox for spacing instead of spacing param.
- AvoidMaxPathRiskRule
- Detects deeply nested path construction that may exceed Windows MAX_PATH.
- AvoidMediaQueryInBuildRule
- Future rule: avoid-listview-without-item-extent
- AvoidMediumFilesRule
- OPINIONATED: Flags files exceeding 300 lines.
- AvoidMediumTestFilesRule
- OPINIONATED: Flags test files exceeding 600 lines.
- AvoidMemoryIntensiveOperationsRule
- Warns when memory-intensive operations are detected.
- AvoidMergedSemanticsHidingInfoRule
- Warns when MergeSemantics might hide important information.
- AvoidMisleadingDocumentationRule
- Warns when documentation is outdated or misleading.
- AvoidMisnamedPaddingRule
- AvoidMissedCallsRule
- Warns when a getter is called without parentheses in print/debugPrint.
- AvoidMissingCompleterStackTraceRule
- Warns when a late final field is assigned twice.
- AvoidMissingEnumConstantInMapRule
- Warns when Completer.completeError is called without stack trace.
- AvoidMissingImageAltRule
- Warns when BuildContext is used in a late field initializer.
- AvoidMissingInterpolationRule
- Suggests using 'use' prefix for custom hooks.
- AvoidMisusedHooksRule
- Warns when hook functions are called inside callbacks or closures.
- AvoidMisusedSetLiteralsRule
- Warns when a set literal is used where another type is expected.
- AvoidMisusedTestMatchersRule
- Warns when raw literals are used as test matchers instead of proper ones.
- AvoidMixedEnvironmentsRule
- Warns when production and development config are mixed in the same class.
- AvoidMixingNamedAndPositionalFieldsRule
- Warns when record type mixes named and positional fields.
- AvoidMoneyArithmeticOnDoubleRule
- Warns when arithmetic operations are performed on double for money.
- AvoidMotionWithoutReduceRule
- Warns when animation plays without respecting user's reduce motion preference.
- AvoidMountedInSetStateRule
- Warns when a widget has a "padding" parameter that is used as margin.
- AvoidMultiAssignmentRule
- Warns when multiple assignments are chained on one line.
- AvoidMultipleAnimationControllersRule
- Warns when a State class declares three or more AnimationController fields.
- AvoidMultipleAutofocusRule
- Warns when multiple widgets have autofocus: true.
- AvoidMultipleMaterialAppsRule
- Warns when Container is used only for whitespace/spacing.
- AvoidMultipleStreamListenersRule
-
Quick fix that adds
.close()call to the dispose/close method. Warns when multiple listeners are added to a non-broadcast stream. - AvoidMutableFieldInEquatableRule
- Warns when Equatable class has non-final (mutable) fields.
- AvoidMutableRxVariablesRule
- Warns when Rx variables are reassigned instead of updated.
- Warns when OverflowBox is used without a comment explaining why.
- Navigator.of() needs proper context from the widget tree.
- Warns when Navigator.push is used without named routes.
- Future rule: avoid-navigator-push-without-route-name
- AvoidNegatedConditionsRule
- Warns when a negated condition can be simplified.
- AvoidNegationsInEqualityChecksRule
- Warns when negation is used in equality checks.
- AvoidNestedAssignmentsRule
- Warns when assignment is used inside another expression.
- AvoidNestedConditionalExpressionsRule
- Warns when conditional expressions (ternary operators) are nested.
- AvoidNestedExtensionTypesRule
- Warns when an assignment is never used.
- AvoidNestedFuturesRule
-
Warns when
Future<Future<T>>is used (nested futures). - Nested Navigators need careful WillPopScope handling.
- AvoidNestedProvidersRule
- Warns when Provider widgets are deeply nested.
- AvoidNestedRecordsRule
- Warns when record types are nested.
- AvoidNestedRoutesWithoutParentRule
- Warns when navigating to nested routes without ensuring parent is in stack.
- AvoidNestedScaffoldsRule
- Warns when Scaffold widgets are nested inside other Scaffolds.
- AvoidNestedScrollablesConflictRule
- Warns when nested scrollables don't have explicit physics.
- AvoidNestedScrollablesRule
- Warns when Opacity widget is animated instead of FadeTransition.
- AvoidNestedShorthandsRule
- Warns when shorthand syntax is nested too deeply.
- AvoidNestedStreamsAndFuturesRule
-
Warns when
Stream<Future<T>>orFuture<Stream<T>>is used. - AvoidNestedSwitchesRule
- Warns when switch statements are nested.
- AvoidNestedSwitchExpressionsRule
- Warns when a switch expression is nested inside another switch.
- AvoidNestedTryRule
- Warns when try statements are nested.
- AvoidNestedTryStatementsRule
- Warns when try statements are nested.
- AvoidNonAsciiSymbolsRule
- Warns when string literals contain non-ASCII characters.
- AvoidNonEmptyConstructorBodiesRule
- Warns when constructor body contains logic.
- AvoidNonFinalExceptionClassFieldsRule
- Warns when exception classes have non-final fields.
- AvoidNonNullAssertionRule
- Warns when the non-null assertion operator (!) is used.
- AvoidNotEncodableInToJsonRule
- Warns when toJson methods return non-JSON-encodable types.
- AvoidNotificationPayloadSensitiveRule
- Warns when notification payloads contain sensitive data.
- AvoidNotificationSameIdRule
- Warns when notifications use the same ID for different notifications.
- AvoidNotificationSilentFailureRule
- Warns when notification show/schedule is called without error handling.
- AvoidNotificationSpamRule
- Warns when notification frequency may be too high.
- AvoidNotifierConstructorsRule
- Quick fix that comments out the problematic notifier assignment. Warns when a Riverpod Notifier class has an explicit constructor.
- AvoidNullableAsyncValuePatternRule
- Warns when nullable AsyncValue patterns are used incorrectly.
- AvoidNullableInterpolationRule
- Warns when interpolating a nullable value in a string.
- AvoidNullableParametersWithDefaultValuesRule
- Warns when nullable parameters have default values that could be non-null.
- AvoidNullableToStringRule
-
Warns when calling
.toString()on a nullable value without null check. - AvoidNullableWidgetMethodsRule
- Warns when Column/Row is used inside SingleChildScrollView without constraints.
- AvoidNullAssertionRule
- Warns when the null assertion operator (!) is used unsafely.
- AvoidObjectCreationInHotLoopsRule
- Warns when objects are created inside hot loops.
- AvoidObsOutsideControllerRule
- Quick fix that adds an onClose() method skeleton to a GetxController. Warns when .obs is used outside a GetxController.
- AvoidOneFieldRecordsRule
- Warns when a record has only one field.
- AvoidOnlyRethrowRule
- Warns when a catch clause only contains a rethrow.
- AvoidOpacityAnimationRule
- Warns when ListView is used with many children instead of ListView.builder.
- AvoidOpacityMisuseRule
- Warns when Opacity is used for animations instead of AnimatedOpacity.
- AvoidOpenaiKeyInCodeRule
- Warns when OpenAI API key pattern is found in source code.
- AvoidOptionalFieldCrashRule
- Warns when JSON fields are accessed without null checks.
- AvoidOverengineeredBlocStatesRule
- Warns when Bloc states are over-engineered.
- AvoidOverFetchingRule
- Warns when API responses fetch more data than needed.
- AvoidOverlappingAnimationsRule
- Warns when multiple animations target the same property.
- AvoidParameterMutationRule
- Warns when function parameters are mutated (object state modified).
- AvoidParameterReassignmentRule
- Warns when function parameters are reassigned.
- AvoidPassingAsyncWhenSyncExpectedRule
- Warns when an async function is passed where a sync function is expected.
- AvoidPassingBlocToBlocRule
- Warns when Bloc constructor receives another Bloc as dependency.
- AvoidPassingBuildContextToBlocsRule
- Warns when BuildContext is passed to Bloc or Cubit.
- AvoidPassingDefaultValuesRule
- Warns when an empty collection default value is passed explicitly.
- AvoidPassingSelfAsArgumentRule
- Warns when an object is passed as an argument to its own method.
- AvoidPathTraversalRule
- Warns when password fields don't use secure keyboard settings.
- AvoidPermissionHandlerNullSafetyRule
- Warns when deprecated permission_handler APIs from pre-null-safety versions
- AvoidPermissionRequestLoopRule
-
Warns when
Permission.request()is called inside a loop. - AvoidPlatformChannelOnWebRule
- Warns when MethodChannel is used without web platform check.
- AvoidPlatformConstructorRule
-
Flags
Platform()constructor usage (deprecated in Dart 3.1). - AvoidPlatformSpecificImportsRule
-
Warns when
dart:iois imported in code that should be platform-agnostic. - AvoidPopWithoutResultRule
- Warns when Navigator.pop result is not handled.
- AvoidPositionalBooleanParametersRule
- Warns when a function or constructor has positional bool parameters.
- AvoidPositionalRecordFieldAccessRule
- Warns when a positional record field is accessed with $1, $2, etc.
- AvoidPositionedOutsideStackRule
-
Warns when
Positionedis used outside of aStackwidget. - AvoidPrefsForLargeDataRule
- Warns when SharedPreferences is used to store large data.
- AvoidPrintErrorRule
- Warns when print() is used for error logging in catch blocks.
- AvoidPrintInProductionRule
- Future rule: avoid-print-in-production
- AvoidPrintInReleaseRule
- Warns when print() is used without kDebugMode check.
- AvoidPrivateTypedefFunctionsRule
- Warns when a private typedef defines a function type.
- AvoidProductionConfigInTestsRule
- Warns when test uses production configuration.
- AvoidProviderInInitStateRule
- Warns when Provider.of or context.read/watch is used in initState.
- AvoidProviderInWidgetRule
- Warns when Riverpod provider is declared inside a widget class.
- AvoidProviderListenFalseInBuildRule
- Warns when Provider.of(context, listen: false) is used inside a build()
- AvoidProviderOfInBuildRule
- Warns when Provider.of is used inside build() without listen: false.
- AvoidProviderRecreateRule
- Warns when ChangeNotifier or Provider is created inside build().
- AvoidProviderValueRebuildRule
- Warns when Provider.value is used with inline notifier creation.
- AvoidPurchaseInSandboxProductionRule
- Warns when sandbox/production environment handling may be incorrect.
- AvoidPushReplacementMisuseRule
- Understand push vs pushReplacement vs pushAndRemoveUntil.
- AvoidQrScannerAlwaysActiveRule
- Warns when QR scanner lacks lifecycle pause/resume handling.
- AvoidRawKeyboardListenerRule
- Warns when deprecated RawKeyboardListener is used.
- AvoidRealDependenciesInTestsRule
- Warns when tests use real network/database calls.
- AvoidRealNetworkCallsInTestsRule
- Warns when test uses real network calls.
- AvoidRealTimerInWidgetTestRule
- Warns when Timer is used in widget tests without fakeAsync.
- AvoidRebuildOnScrollRule
- Warns when scroll listeners are registered in build method.
- AvoidRecursiveCallsRule
- Warns when a function calls itself directly (recursive call).
- AvoidRecursiveToStringRule
- Warns when toString() method calls itself, causing infinite recursion.
- AvoidRecursiveWidgetCallsRule
- Warns when a widget references itself in its build method.
- AvoidRedirectInjectionRule
- Warns when redirect URL is taken from parameter without domain validation.
- AvoidRedundantAsyncOnLoadRule
- Warns when onLoad() is async but doesn't contain any await.
- AvoidRedundantAsyncRule
- Warns when async is used but no await is present in the function body.
- AvoidRedundantAwaitRule
-
Warns when
awaitis used on a non-Future expression. - AvoidRedundantElseRule
- Warns when else is redundant after a return/throw/continue/break.
- AvoidRedundantNullCheckRule
-
Warns when comparing a non-nullable value with
null. - AvoidRedundantPositionalFieldNameRule
- Warns when positional record field has an explicit name that matches
- AvoidRedundantPragmaInlineRule
- Warns when @pragma('vm:prefer-inline') is used redundantly.
- AvoidRedundantRequestsRule
- Warns when the same API endpoint might be called redundantly.
- AvoidRedundantSemanticsRule
- Warns when Semantics wraps an Image that already has semanticLabel.
- AvoidReferencingDiscardedVariablesRule
- Warns when referencing discarded/underscore-prefixed variables.
- AvoidReferencingSubclassesRule
- Warns when a base class references its subclasses directly.
- AvoidRefInBuildBodyRule
- Warns when ref.read() is used inside a build() method body.
- AvoidRefInDisposeRule
- Warns when ref is used in dispose method.
- AvoidRefInsideStateDisposeRule
-
Warns when
refis accessed inside adispose()method. - AvoidRefReadInsideBuildRule
-
Warns when
ref.read()is used inside abuild()method. - AvoidRefreshWithoutAwaitRule
- Warns when RefreshIndicator onRefresh doesn't return Future.
- AvoidRefWatchOutsideBuildRule
-
Warns when
ref.watch()is used outside abuild()method. - AvoidRegexInLoopRule
- Future rule: avoid-regex-in-loop
- AvoidRemovedAbstractClassInstantiationErrorRule
-
Detects references to the removed
AbstractClassInstantiationError. - AvoidRemovedAppbarBackwardsCompatibilityRule
-
Flags usage of the removed
AppBar.backwardsCompatibilityparameter. - AvoidRemovedBidirectionalIteratorRule
-
Detects references to the removed
BidirectionalIteratorinterface. - AvoidRemovedCastErrorRule
-
Detects references to the removed
CastErrortype (Dart 3.0). - AvoidRemovedCyclicInitializationErrorRule
-
Detects references to the removed
CyclicInitializationError. - AvoidRemovedDartDeveloperMetricsRule
-
Flags removed observability metric types from
dart:developer(Dart 3.0). - AvoidRemovedDeferredLibraryRule
-
Detects the removed
DeferredLibraryclass / annotation (Dart 3.0). - AvoidRemovedFallThroughErrorRule
-
Detects references to the removed
FallThroughError(Dart 3.0). - AvoidRemovedJsNumberToDartRule
-
Flags the removed
JSNumber.toDartgetter fromdart:js_interop. - AvoidRemovedMaxUserTagsConstantRule
-
Flags the removed
UserTag.MAX_USER_TAGSconstant (Dart 3.0,dart:developer). - AvoidRemovedNoSuchMethodErrorDefaultConstructorRule
- Detects the removed default constructor on NoSuchMethodError (Dart 3.0).
- AvoidRemovedNullThrownErrorRule
-
Flags references to the removed
NullThrownErrortype (Dart 3.0). - AvoidRemovedProvisionalAnnotationRule
-
Detects the removed
@Provisionalannotation (Dart 3.0). - AvoidRemovedProxyAnnotationRule
-
Detects the removed
@proxyannotation (Dart 3.0). - AvoidRemovedRenderObjectElementMethodsRule
-
Flags removed
RenderObjectElementmethods (Flutter 3.0, PR #98616). - AvoidRenamingRepresentationGettersRule
- Warns when an extension type exposes the representation under a different name.
- AvoidRepaintBoundaryMisuseRule
- Future rule: avoid-repainting-boundary-misuse
- AvoidRetainingDisposedWidgetsRule
- Warns when widget or State references are stored in non-widget classes.
- AvoidReturnAwaitDbRule
-
Warns on
return await dbWriteCall()— the caller has no chance to yield. - AvoidReturningCascadesRule
- Warns when returning a cascade expression.
- AvoidReturningNullForFutureRule
-
Warns when returning
nullfrom a non-asyncFuturefunction. - AvoidReturningNullForVoidRule
-
Warns when returning
nullfrom a function withvoidreturn type. - AvoidReturningThisRule
- Avoid returning this from methods; prefer explicit return types.
- AvoidReturningValueFromCubitMethodsRule
- Warns when Cubit methods return values instead of emitting states.
- AvoidReturningVoidRule
-
Warns when a function explicitly returns
void. - AvoidReturningWidgetsRule
-
Warns when
mountedis referenced inside setState callback. - AvoidRiverpodForNetworkOnlyRule
- Warns when Riverpod is used only for network/API access.
- Riverpod shouldn't handle navigation via global navigator keys.
- AvoidRiverpodNotifierInBuildRule
- Warns when Riverpod Notifiers are instantiated in build methods.
- AvoidRiverpodStateMutationRule
- Warns when state is mutated directly instead of using state assignment.
- AvoidRiverpodStringProviderNameRule
- Provider.name should be auto-generated; detect manual name strings.
- AvoidScaffoldMessengerAfterAwaitRule
- Future rule: avoid-uncontrolled-text-field
- AvoidScreenshotInCiRule
- AvoidScreenshotSensitiveRule
- Warns when sensitive screens don't disable screenshots.
- AvoidScrollableInIntrinsicRule
-
Warns when a scrollable widget is placed inside
IntrinsicHeightor - AvoidScrollListenerInBuildRule
- Warns when scroll listener is added in build method.
- AvoidSecureStorageLargeDataRule
- Secure storage isn't designed for large data (>1KB).
- AvoidSecureStorageOnWebRule
- Warns when flutter_secure_storage is used in web builds.
- AvoidSelfAssignmentRule
- Warns when a variable is assigned to itself.
- AvoidSelfCompareRule
- Warns when a variable is compared to itself.
- AvoidSemanticsExclusionRule
- Warns when excludeFromSemantics is used without a comment explaining why.
- AvoidSemanticsInAnimationRule
- AvoidSensitiveDataInClipboardRule
- Warns when sensitive data is copied to clipboard.
- AvoidSensitiveInLogsRule
- Warns when sensitive data is logged.
- AvoidSequentialAwaitsRule
- Warns when multiple independent awaits are performed sequentially.
- AvoidServiceLocatorInWidgetsRule
- Warns when service locator is accessed directly in widgets.
- AvoidServiceLocatorOveruseRule
- Future rule: avoid-service-locator-overuse
- AvoidSetStateInBuildRule
- Warns when setState is called during build.
- AvoidSetStateInDisposeRule
- Warns when setState is called inside dispose().
- AvoidSetStateInLargeStateClassRule
- Warns when setState() is called in a large State class.
- AvoidSettersWithoutGettersRule
- Warns when a setter has no corresponding getter in the class hierarchy.
- AvoidShadowedExtensionMethodsRule
- Warns when an extension method shadows a class method.
- AvoidShadowingRule
- Warns when a variable or parameter shadows another declaration from an
- AvoidShadowingTypeParametersRule
- Warns when a method's type parameter shadows the enclosing class's type parameter.
- Warns when SharedPreferences is used inside an isolate.
- Warns when SharedPreferences is used to store large or serialized data.
- Warns when sensitive data is stored in SharedPreferences.
- Warns when SharedPreferences write methods are not awaited in async code.
- AvoidShrinkWrapExpensiveRule
- Warns when shrinkWrap: true is used in scrollables (expensive operation).
- AvoidShrinkWrapInListsRule
- Warns when an Image widget is wrapped in Opacity instead of using Image.color.
- AvoidShrinkWrapInScrollRule
- Warns when Positioned is used instead of PositionedDirectional.
- AvoidShrinkWrapInScrollViewRule
- Warns when shrinkWrap: true is used inside a ScrollView.
- AvoidSimilarNamesRule
- Warns when a map indexed by enum is missing some enum values.
- AvoidSingleCascadeInExpressionStatementsRule
- Warns when a cascade expression has exactly one section and is used as a statement.
- AvoidSingleChildColumnRowRule
- Warns when a Column or Row has only a single child.
- AvoidSingleChildScrollViewWithColumnRule
- Future rule: avoid-layout-builder-in-build
- AvoidSingleFieldDestructuringRule
- Warns when destructuring is used for only one field.
- AvoidSingletonForScopedDependenciesRule
- Warns when scoped dependencies are registered as singletons.
- AvoidSingletonPatternRule
- Warns when singleton pattern is overused.
- AvoidSizedBoxExpandRule
- Warns when multiple MaterialApp widgets exist in the widget tree.
- AvoidSlowCollectionMethodsRule
- Warns when slow collection methods are used.
- AvoidSmallTextRule
- Warns when text size is smaller than the recommended minimum.
- AvoidSmallTouchTargetsRule
- Warns when touch targets are potentially too small for accessibility.
- AvoidSnackbarInBuildRule
- Warns when showSnackBar is called inside build().
- AvoidSnackbarQueueBuildupRule
- Warns when showSnackBar is called without clearing previous snackbars.
- AvoidSpacerInWrapRule
- AvoidSqfliteReadAllColumnsRule
- Warns when SELECT * is used in sqflite rawQuery() calls.
- AvoidSqfliteReservedWordsRule
- Warns when SQLite reserved words are used as column names.
- AvoidSqfliteTypeMismatchRule
- Warns when SQLite column types may not match Dart types correctly.
- AvoidStackTraceInProductionRule
- Secure storage operations can fail and need error handling.
- AvoidStackWithoutPositionedRule
- Warns when IconButton lacks a tooltip for accessibility.
- AvoidStateConstructorsRule
- Warns when a method returns a Widget.
- AvoidStatefulTestSetupRule
- Warns when test setUp uses mutable shared state.
- AvoidStatefulWidgetInListRule
- Future rule: avoid-gesture-detector-in-scrollview
- AvoidStatefulWithoutStateRule
- Warns when a State class has no mutable state, lifecycle methods, or
- AvoidStatelessWidgetInitializedFieldsRule
- Warns when a StatelessWidget has initialized fields.
- AvoidStaticRouteConfigRule
- Reminder to add NSPhotoLibraryUsageDescription for image_picker on iOS.
- AvoidStaticStateRule
- Warns when static mutable state is used.
- AvoidStoringContextRule
- Warns when BuildContext is stored in a field.
- AvoidStoringPasswordsRule
- Warns when eval-like patterns are detected.
- AvoidStoringSensitiveUnencryptedRule
- Warns when WebView is created without explicitly disabling JavaScript.
- AvoidStoringUserDataInAuthRule
- Warns when setCustomClaims stores large user data.
- AvoidStreamInBuildRule
- Warns when StreamController is created inside build() method.
- AvoidStreamSubscriptionInFieldRule
- Warns when stream.listen() is called without capturing the returned StreamSubscription.
- AvoidStreamSyncEventsRule
- Warns when synchronous events are added to a stream.
- AvoidStreamToStringRule
- Warns when a Stream is converted to String via toString().
- AvoidStringConcatenationForL10nRule
- Warns when string concatenation is used for localized text.
- AvoidStringConcatenationInUiRule
- Warns when string concatenation is used for sentences.
- AvoidStringConcatenationL10nRule
- String concatenation breaks word order in translations.
- AvoidStringConcatenationLoopRule
- Warns when string concatenation is used inside loops.
- AvoidStringEnvParsingRule
-
Warns when
fromEnvironment()is called without adefaultValue. - AvoidSubstringRule
- Warns when String.substring() is used.
- AvoidSudoShellCommandsRule
-
Quick fix that adds a
fontFamilyFallbackparameter with common cross-platform fonts that are available on Linux. Detects Process.run calls that invoke sudo or assume root privileges. - AvoidSupabaseAnonKeyInCodeRule
- Warns when Supabase anon key is hardcoded in source code.
- AvoidSwallowingExceptionsRule
- Warns when catch block swallows exception without logging.
- AvoidSynchronousFileIoRule
- Warns when synchronous file I/O is used instead of async.
- AvoidSyncOnEveryChangeRule
- Syncing each keystroke wastes battery and bandwidth.
- AvoidTableCellOutsideTableRule
-
Warns when
TableCellis used outside of aTablewidget. - AvoidTestCouplingRule
- Warns when tests depend on other tests' side effects.
- AvoidTestImplementationDetailsRule
- Warns when tests verify internal implementation details.
- AvoidTestOnRealDeviceRule
- Warns when test name suggests running on real device.
- AvoidTestPrintStatementsRule
- Warns when print() is used in test files.
- AvoidTestSleepRule
- Warns when sleep() or blocking delays are used in tests.
- AvoidTextfieldInRowRule
-
Warns when
ListView,GridView, orCustomScrollViewis placed - AvoidTextInImagesRule
- Warns when images contain text that should be localized.
- AvoidTextScaleFactorIgnoreRule
- Warns when textScaleFactor is set to 1.0, ignoring user accessibility settings.
- AvoidTextScaleFactorRule
- Future rule: prefer-const-widgets-in-lists
- AvoidTextSpanInBuildRule
- Warns when TextSpan is created in build method.
- AvoidThrowInCatchBlockRule
- Warns when throw is used inside a catch block, which loses the stack trace.
- AvoidThrowInFinallyRule
- Warns when throw is used in finally blocks.
- AvoidThrowObjectsWithoutToStringRule
- Warns when throwing an object that doesn't have a toString() override.
- AvoidTightCouplingWithGetxRule
- Warns when GetX is used excessively throughout a file.
- AvoidTimeLimitsRule
- Warns when timed interactions disadvantage users who need more time.
- AvoidTokenInUrlRule
- Warns when tokens or API keys appear in URLs.
- AvoidTooManyDependenciesRule
- Warns when constructor has too many dependencies.
- AvoidTopLevelMembersInTestsRule
- Warns when public top-level members are declared in test files.
- AvoidTouchOnlyGesturesRule
- Warns when GestureDetector only handles touch gestures.
- AvoidTypeCastsRule
-
Warns when
askeyword is used for type casting. - AvoidTypesOnClosureParametersRule
- Warns when closure (function expression) parameters have explicit types that can usually be inferred.
- AvoidUiInDomainLayerRule
- Warns when presentation logic is in domain layer.
- AvoidUnassignedFieldsRule
- Warns when the same condition appears in nested if statements.
- AvoidUnassignedLateFieldsRule
- Warns when a late field is never assigned a value.
- AvoidUnassignedStreamSubscriptionsRule
- Warns when .listen() result is not assigned to a variable.
- AvoidUnawaitedFutureRule
- Warns when a Future is not awaited and not explicitly marked.
- AvoidUnboundedCacheGrowthRule
- Warns when caches can grow without bounds.
- AvoidUnboundedConstraintsRule
- Warns when Column/Row inside SingleChildScrollView may have unbounded
- AvoidUnboundedListviewInColumnRule
-
Warns when
RoworColumnusesCrossAxisAlignment.baseline - AvoidUncaughtFutureErrorsRule
- Warns when fire-and-forget Future lacks error handling.
- AvoidUnconditionalBreakRule
- Warns when break or continue is unconditionally executed.
- AvoidUnconstrainedBoxMisuseRule
- Warns when UnconstrainedBox is used improperly causing overflow.
- AvoidUnconstrainedDialogColumnRule
-
Warns when a
Columninside anAlertDialogorSimpleDialogis - AvoidUnconstrainedImagesRule
- Warns when Image widgets don't have sizing constraints.
- AvoidUncontrolledTextFieldRule
- Warns when a State class has disposable fields that are not properly disposed.
- AvoidUndisposedInstancesRule
- Warns when disposable instances are created but not disposed.
- AvoidUnguardedDebugRule
-
Warns when
debugPrint()calls are not guarded by a debug check. - AvoidUnknownPragmaRule
- Warns when unknown pragma annotations are used.
- AvoidUnmarkedPublicClassRule
- Warns when a public class lacks an explicit class modifier.
- AvoidUnnecessaryBlockRule
- Warns when unnecessary block braces are used.
- AvoidUnnecessaryCallRule
-
Warns when
.call()is used explicitly on a callable. - AvoidUnnecessaryCollectionsRule
- Warns when unnecessary collection wrappers are used.
- AvoidUnnecessaryCompareToRule
- Warns when compareTo is used for equality instead of ==.
- AvoidUnnecessaryConditionalsRule
- Warns when a condition is always true or always false.
- AvoidUnnecessaryConstructorRule
- Warns when a class has an empty constructor (no parameters, no body, no initializers).
- AvoidUnnecessaryConsumerWidgetsRule
- Warns when ConsumerWidget doesn't use ref.
- AvoidUnnecessaryContainersRule
- Warns when a Container has only a child (or key + child), adding no value.
- AvoidUnnecessaryContinueRule
- Warns when continue is redundant (at end of loop body).
- AvoidUnnecessaryDigitSeparatorsRule
- Warns when digit separators are used unnecessarily.
- AvoidUnnecessaryEnumArgumentsRule
- Warns when enum arguments match the default and can be omitted.
- AvoidUnnecessaryEnumPrefixRule
- Warns when using enum name prefix inside the enum declaration.
- AvoidUnnecessaryExtendsRule
- Warns when a class explicitly extends Object.
- AvoidUnnecessaryFuturesRule
- Warns when async/await is used unnecessarily.
- AvoidUnnecessaryGestureDetectorRule
- Warns when shrinkWrap is used in nested scrollable lists.
- AvoidUnnecessaryGetterRule
- Warns when a getter just returns a final field without any logic.
- AvoidUnnecessaryHookWidgetsRule
- Warns when a HookWidget doesn't use any hooks.
- AvoidUnnecessaryIfRule
- Warns on patterns like if (condition) return true; return false;
- AvoidUnnecessaryLateFieldsRule
- Warns when late is used but field is assigned in constructor.
- AvoidUnnecessaryLengthCheckRule
- Warns when length > 0 or length != 0 can be replaced with isNotEmpty.
- AvoidUnnecessaryLocalLateRule
- Warns when using default/wildcard case with sealed classes.
- AvoidUnnecessaryLocalVariableRule
- Warns when a variable is declared, used once, and returned immediately.
- AvoidUnnecessaryNegationsRule
- Warns when negation can be simplified.
- AvoidUnnecessaryNullableFieldsRule
- Warns when a nullable field is always non-null.
- AvoidUnnecessaryNullableParametersRule
- Warns when variable names are too similar.
- AvoidUnnecessaryNullableReturnTypeRule
- Warns when a function's return type is nullable but never returns null.
- AvoidUnnecessaryNullAwareElementsRule
- Warns when null-aware spread (...?) is used for collections that cannot be null.
- AvoidUnnecessaryOverridesInStateRule
- Warns when State class has unnecessary overrides.
- AvoidUnnecessaryOverridesRule
- Warns when an override just calls super without additional logic.
- AvoidUnnecessaryPatternsRule
- Warns when a pattern doesn't affect type narrowing.
- AvoidUnnecessaryReassignmentRule
- Warns when a variable is assigned the same value it already has.
- AvoidUnnecessaryReturnRule
- Warns on unnecessary return statement at end of void function.
- AvoidUnnecessarySetStateRule
- Warns when setState is called directly in a lifecycle method.
- AvoidUnnecessaryStatefulWidgetsRule
- Warns when a StatefulWidget could be a StatelessWidget.
- AvoidUnnecessaryStatementsRule
- Warns when a statement has no effect.
- AvoidUnnecessarySuperRule
- Warns when super call is unnecessary in constructor.
- AvoidUnnecessaryToListRule
- Warns when .toList() is called unnecessarily on iterable operations.
- AvoidUnnecessaryTypeAssertionsRule
- Warns when a type assertion (is check) is unnecessary.
- AvoidUnnecessaryTypeCastsRule
- Warns when a type cast (as) is unnecessary.
- AvoidUnreachableForLoopRule
- Warns when a for loop has impossible or unreachable bounds.
- Warns when an 'is' type check can never be true.
- Quick fix for PreferExplicitTypeArgumentsRule.
- AvoidUnremovableCallbacksInListenersRule
- Warns when anonymous functions are used in listener methods.
- AvoidUnrestrictedTextFieldLengthRule
- Future rule: avoid-unrestricted-text-field-length
- AvoidUnsafeCastRule
-
Warns when
ascast is used without null check. - AvoidUnsafeCollectionMethodsRule
- Warns when using .first or .last on potentially empty collections.
- AvoidUnsafeDeserializationRule
- Warns when JSON is decoded from untrusted sources without type validation.
- AvoidUnsafeReduceRule
- Warns when reduce() is called on a potentially empty collection.
- AvoidUnsafeSetStateRule
-
Warns when
setState()is called without amountedcheck. - AvoidUnsafeWhereMethodsRule
- Warns when firstWhere/lastWhere/singleWhere is used without orElse.
- AvoidUnusedAfterNullCheckRule
- Warns when a variable is null-checked but not used afterward.
- AvoidUnusedAssignmentRule
- Warns when accessing collection elements by constant index in a loop.
- AvoidUnusedCallbackParametersRule
- Future rule: avoid-unused-parameters-in-callbacks
- AvoidUnusedConstructorParametersRule
- Warns when a constructor parameter is not stored in a field or used.
- AvoidUnusedGenericsRule
- Warns when type parameters are declared but never used.
- AvoidUnusedInstancesRule
- Warns when an instance is created but never used.
- AvoidUnusedParametersRule
- Warns when a function parameter is unused.
- AvoidUnverifiedNativeLibraryRule
- Warns when native libraries are loaded from dynamic or absolute paths.
- AvoidUrlLauncherSimulatorTestsRule
- Warns when URL launcher tests may fail on simulator/emulator.
- AvoidUserControlledUrlsRule
- Warns when user-controlled input is used directly in HTTP requests.
- AvoidVagueTestDescriptionsRule
- Warns when test description is too vague.
- AvoidValidationInBuildRule
- Warns when complex validation logic is in build method.
- AvoidVeryLongFilesRule
- OPINIONATED: Flags files exceeding 1000 lines.
- AvoidVeryLongTestFilesRule
- OPINIONATED: Flags test files exceeding 2000 lines.
- AvoidVoidAsyncRule
-
Warns when an async function returns
voidinstead ofFuture<void>. - AvoidWatchInCallbacksRule
- Warns when Provider is watched unnecessarily in callbacks.
- AvoidWeakCryptographicAlgorithmsRule
- Warns when weak cryptographic algorithms like MD5 or SHA1 are used.
- AvoidWebOnlyDependenciesRule
- Warns when web-only packages are imported in non-web code.
- AvoidWebsocketMemoryLeakRule
- Warns when WebSocketChannel is used without proper cleanup in dispose.
- AvoidWebsocketWithoutHeartbeatRule
- Warns when WebSocket is used without heartbeat/ping mechanism.
- AvoidWebViewCorsIssuesRule
- Warns when WebView CORS bypass settings are enabled.
- AvoidWebviewFileAccessRule
- Warns when WebView has file access enabled.
- AvoidWebViewInsecureContentRule
- Warns when WebView allows loading mixed (HTTP) content on HTTPS pages.
- AvoidWebViewJavaScriptEnabledRule
- Warns when WebView has JavaScript enabled without consideration.
- AvoidWidgetCreationInLoopRule
- Warns when widgets are created inside loops in build method.
- AvoidWildcardCasesWithEnumsRule
- Warns when contradicting conditions are used.
- AvoidWildcardCasesWithSealedClassesRule
- Warns when an extension type contains another extension type.
- AvoidWorkInPausedStateRule
- Warns when Timer or periodic work runs without AppLifecycleState check.
- AvoidWrappingInPaddingRule
- Warns when Image widget is missing semanticLabel (alt text).
- AvoidX11OnlyAssumptionsRule
- Detects X11-specific code without Wayland fallback considerations.
- AvoidYieldInOnEventRule
- Warns when yield is used inside Bloc event handler.
- BannedUsageRule
- Prefer named boolean parameters for functions with few parameters.
- BaselineConfig
- BaselineDate
- Date-based baseline for ignoring violations in code older than a specified date.
- BaselineFile
- Handles reading and writing baseline JSON files.
- BaselineManager
- Central manager for baseline functionality.
- BaselinePaths
- BinaryExpressionOperandOrderRule
- Warns when binary expression operands could be reordered for clarity.
- CheckForEqualsInRenderObjectSettersRule
- Warns when RenderObject setters don't check for equality.
- CheckIsNotClosedAfterAsyncGapRule
- Warns when emit() is called after an await without checking isClosed.
- CheckMountedAfterAsyncRule
- Warns when setState or context is accessed after await without mounted check.
- ConflictingConstructorAndStaticMemberRule
- Named constructor shares a name with a static member (invalid Dart).
- ConsistentUpdateRenderObjectRule
- Warns when updateRenderObject doesn't update all properties set in createRenderObject.
- ContentFingerprint
- Fast content fingerprint for quick similarity detection.
- ContentRegionIndex
- Indexes file content into regions for targeted rule scanning.
- ContentRegions
- Pre-indexed content regions for targeted scanning.
- DependOnReferencedPackagesRule
- Warns when an imported package is not listed in pubspec dependencies.
- DeprecatedNewInCommentReferenceRule
-
Doc comments should not use deprecated
newin reference links. - DisposeClassFieldsRule
- Warns when class fields of disposable types are not disposed.
- DisposeFieldsRule
- Warns when fields that need disposal are not disposed.
- DisposeGetxFieldsRule
- Warns when GetxController has Worker fields that are not disposed.
- DisposeProvidedInstancesRule
- Warns when Provider.create returns a disposable instance without dispose callback.
- DisposeProvidersRule
-
Warns when
Providerlacks a dispose callback for disposable instances. - DocumentIgnoresRule
-
// ignore:/// ignore_for_file:should include an on-line explanation after the rule list (not only rule names). - DoubleLiteralFormatRule
- Warns when double literals don't follow a consistent format.
- DuplicateConstructorRule
- More than one unnamed constructor or duplicate same-named constructor.
- DuplicateIgnoreRule
-
Flags when the same diagnostic is listed more than once in a single
// ignore:or// ignore_for_file:comment (e.g.// ignore: rule_a, rule_a). - DuplicateRecordFieldNameRule
- Record literal or record type annotation uses the same field name twice.
- EmitNewBlocStateInstancesRule
- Warns when Bloc state is mutated with cascade instead of new instance.
- EnumConstantsOrderingRule
- Warns when enum constants are not in alphabetical order.
- ExtendEquatableRule
- Warns when a class overrides operator == but doesn't extend Equatable.
- ExternalWithInitializerRule
- Warns when an external field or variable has an initializer.
- FieldInitializerRedirectingConstructorRule
- Redirecting constructor must not mix field/super initializers with redirect.
- FileMetrics
- Cached metrics about a file's content.
- FileMetricsCache
- Computes and caches file metrics for fast access.
- FileTypeDetector
- Fast file type detection based on file path and content.
- FormatCommentFormattingRule
- Warns when comments don't follow formatting conventions.
- FormatCommentRule
- Warns when single-line comments don't start with a capital letter.
- FormatTestNameRule
- Warns when test name is not in snake_case format.
- FunctionAlwaysReturnsNullRule
- Warns when a function always returns null.
- FunctionAlwaysReturnsSameValueRule
- Warns when using default/wildcard case with enums.
- HandleThrowingInvocationsRule
- Invocations that can throw should be handled (try/catch or @Throws).
- IllegalConcreteEnumMemberRule
-
Concrete
index,hashCode, or==on enum / Enum implementer / mixin on Enum. - IllegalEnumValuesRule
-
An enum must not declare an instance member named
values, because enums expose a staticvaluesgetter and the instance member would shadow or conflict. - ImpactTracker
- Tracks lint violations by impact level for summary reporting.
- IncorrectFirebaseEventNameRule
- Warns when Firebase Analytics event name doesn't follow conventions.
- IncorrectFirebaseParameterNameRule
- Warns when Firebase Analytics parameter name doesn't follow conventions.
- IncrementalAnalysisTracker
- Tracks clean files for incremental analysis optimization.
- InvalidExtensionArgumentCountRule
- Extension override must pass exactly one argument (the extended value).
- InvalidLiteralAnnotationRule
-
@literalmust annotate a const constructor (package:meta). - InvalidNonVirtualAnnotationRule
-
@nonVirtualonly on concrete instance members of class or mixin (package:meta). - InvalidRecordFieldNameRule
- Record field label uses a reserved keyword (invalid identifier for the label).
- InvalidRuntimeCheckWithJsInteropTypesRule
-
Warns when using
isoris!with a JS interop type at runtime; JS interop types are not real Dart types at runtime and the check is invalid or unreliable. - InvalidSuperFormalParameterLocationRule
- Super parameter only allowed on non-redirecting generative constructors.
- InvalidVisibleOutsideTemplateAnnotationRule
-
Warns when
@visibleOutsideTemplateis used incorrectly. - LazyPattern
- Lazily compiled regex patterns.
- LazyPatternCache
- Cache of lazily compiled patterns.
- ListAllEquatableFieldsRule
- Warns when an Equatable subclass has fields not listed in props.
-
LruCache<
K, V> - Generic LRU cache with size limits.
- MapKeysOrderingRule
- Warns when map literal keys are not in alphabetical order.
- MatchBaseClassDefaultValueRule
- Warns when an overriding method specifies default values that look suspicious.
- MatchClassNamePatternRule
- Warns when class names don't match expected patterns.
- MatchGetterSetterFieldNamesRule
- Warns when getter/setter names don't match backing field names.
- MatchLibFolderStructureRule
- Warns when test files don't match lib folder structure.
- MatchPositionalFieldNamesOnAssignmentRule
- Warns when positional field names don't match the variable being assigned.
- MaxImportsRule
- Warns when a file has too many import statements.
- MemberOrderingFormattingRule
- Warns when class members are not in the conventional order.
- MemoryPressureHandler
- Handles memory pressure by clearing caches.
- MissingCodeBlockLanguageInDocCommentRule
- Warns when a fenced code block in a doc comment lacks a language tag.
- MissingTestAssertionRule
- Warns when a test body has no assertions.
- MissingUseResultAnnotationRule
- Warns when a function returns a value that should have @useResult.
- MoveRecordsToTypedefsRule
- Warns when inline record types should be moved to typedefs.
- MoveVariableCloserToUsageRule
- Warns when a variable could be declared closer to its usage.
- MoveVariableOutsideIterationRule
- Warns when a variable could be moved outside a loop.
- NewlineAfterLoopRule
- Warns when there is no blank line after a for or while loop before the next statement.
- NewlineBeforeCaseRule
- Warns when case clauses don't have newlines before them.
- NewlineBeforeConstructorRule
- Warns when constructors don't have blank lines before them.
- NewlineBeforeElseRule
-
Warns when there is no blank line before a standalone
elseclause. - NewlineBeforeMethodRule
- Warns when methods don't have blank lines before them.
- NewlineBeforeReturnRule
- Warns when there's no blank line before a return statement.
- NoBooleanLiteralCompareRule
- Warns when comparing boolean expressions to boolean literals.
- NoEmptyBlockRule
- Warns when an empty block is used.
- NoEmptyStringRule
- Warns when an empty string literal is used.
- NoEqualArgumentsRule
- Warns when the same argument value is passed multiple times.
- NoEqualConditionsRule
- Warns when the same condition appears multiple times in an if-else chain.
- NoEqualNestedConditionsRule
- Warns when a function always returns the same value.
- NoEqualSwitchCaseRule
- Warns when switch cases have identical bodies.
- NoEqualSwitchExpressionCasesRule
- Warns when switch expression cases have identical expressions.
- NoEqualThenElseRule
- Warns when if and else branches have identical code.
- NoMagicNumberInTestsRule
- Warns when magic numbers are used in test files.
- NoMagicNumberRule
- Warns when magic numbers are used instead of named constants.
- NoMagicStringInTestsRule
- Warns when magic strings are used in test files.
- NoMagicStringRule
- Warns when string literals are used directly (magic strings).
- NonConstantMapElementRule
-
ifor spread element in a const map must be a constant expression. - NoObjectDeclarationRule
-
Warns when a member is declared with type
Object. - NoRuntimeTypeToStringRule
-
Avoid calling
toString()onruntimeType. - NullifyAfterDisposeRule
- Suggests nullifying nullable disposable fields after disposal.
- OwaspMapping
- OWASP mapping for a lint rule.
- PackageNamesRule
- Warns when the pubspec package name does not follow conventions.
- ParametersOrderingConventionRule
- Warns when parameters are not in conventional order.
- PassCorrectAcceptedTypeRule
- Warns when a parameter type doesn't match the accepted type annotation.
- PassExistingFutureToFutureBuilderRule
- Warns when a new Future is created inside FutureBuilder.
- PassExistingStreamToStreamBuilderRule
- Warns when a new Stream is created inside StreamBuilder.
- PassOptionalArgumentRule
- Warns when an optional argument is not passed but could improve clarity.
- PatternFieldsOrderingRule
- Warns when pattern fields are not in alphabetical order.
- PatternIndex
- Builds and manages a combined pattern index for fast rule filtering.
- PreferAbsoluteImportsRule
- Quick fix for PreferDoubleQuotesRule.
- PreferAbstractDependenciesRule
- Warns when abstract class is not used for dependency contracts.
- PreferAbstractFinalStaticClassRule
- Warns when a class with only static members could be abstract final.
- PreferAbstractionInjectionRule
- Inject interfaces/abstract classes, not concrete implementations.
- PreferActionButtonTooltipRule
- Warns when methods return nullable Widget? types.
- PreferActionsAndShortcutsRule
- Warns when LayoutBuilder is used inside a scrollable widget.
- PreferAdaptiveDialogRule
- Warns when showDialog doesn't use adaptive styling.
- PreferAdaptiveIconsRule
- Warns when Icon widget uses a hardcoded size.
- PreferAddAllOverSpreadRule
- Warns when spread is used instead of addAll() (opposite rule).
- PreferAddAllRule
- Warns when forEach with add is used instead of addAll.
- PreferAdditionSubtractionAssignmentsRule
- Warns when x = x + 1 could be x += 1 (or similar).
- PreferAdequateSpacingRule
- Quick fix to increase animation duration to 333ms (WCAG 2.3.1 compliant). Warns when touch targets have insufficient spacing.
- PreferAdjacentStringsRule
- Warns when two string literals are concatenated with + instead of adjacent strings.
- PreferAdjectiveBoolGettersRule
- Warns when a bool getter uses a verb name instead of a predicate/adjective.
- PreferAlignOverContainerRule
-
Warns when
Containeris used only for alignment. - PreferAllNamedParametersRule
- Warns when functions have multiple positional parameters that could be named.
- PreferAnnounceForChangesRule
- PreferAnyOrEveryRule
- Warns when a named parameter is passed as null explicitly.
- PreferArrowFunctionsRule
- Warns when block body functions could be written as arrow functions.
- PreferAsmapOverIndexedIterationRule
- Prefer asMap().entries for indexed iteration over manual index.
- PreferAssertsInInitializerListsRule
- Warns when assert() in a constructor body could be moved to the initializer list.
- PreferAssetImageForLocalRule
- Warns when PageStorageKey is not used for scroll position preservation.
- PreferAssigningAwaitExpressionsRule
- Warns when await is used inline instead of assigning to a variable first.
- PreferAsyncAwaitRule
- Warns when .then() is used instead of async/await in async functions.
- PreferAsyncCallbackRule
-
Warns when
VoidCallbackis used for a callback that likely performs async operations. - PreferAsyncInitStateRule
- Warns when async operations should use FutureBuilder in initState pattern.
- PreferAudioSessionConfigRule
- Warns when AudioPlayer is used without audio session configuration.
- PreferAutoRoutePathParamsSimpleRule
- Prefer simple types for auto_route path parameters.
- PreferAutoRouteTypedArgsRule
- Prefer typed route arguments over Map or dynamic.
- PreferAutovalidateOnInteractionRule
- Warns when AutovalidateMode.always is used.
- PreferAvatarLoadingPlaceholderRule
- Warns when CircleAvatar uses a NetworkImage for backgroundImage without
- PreferAwaitOverThenRule
- Warns when a function is marked async but doesn't use await.
- PreferBackgroundSyncRule
- Suggests using BGTaskScheduler for background sync on iOS.
- PreferBaseClassRule
-
Warns when an abstract class with implementation could be
base. - PreferBasePrefixRule
- Warns when abstract or base class name does not end with Base.
- PreferBatchRequestsRule
- Prefer batch API calls over multiple small requests in a loop.
- PreferBinaryFormatRule
- Prefer Protocol Buffers or MessagePack for high-frequency or large JSON.
- PreferBiometricProtectionRule
- Warns when FlutterSecureStorage is used without biometric protection.
- PreferBlankLineAfterDeclarationsRule
- Warns when there is no blank line after variable declarations.
- PreferBlankLinesBetweenMembersRule
- Warns when there are no blank lines between class members.
- PreferBleMtuNegotiationRule
- Warns when BLE data transfer occurs without MTU negotiation.
- PreferBlocEventSuffixRule
- Suggests that Bloc event classes end with 'Event' suffix.
- PreferBlocExtensionsRule
- Prefer Bloc extension methods (context.read, context.watch) over BlocProvider.of.
- PreferBlocHydrationRule
- Warns when Bloc uses SharedPreferences instead of HydratedBloc for persistence.
- PreferBlockBodySettersRule
- Prefer block body {} for setters.
- PreferBlocListenerForSideEffectsRule
- Warns when side effects (navigation, snackbar) are performed in BlocBuilder.
- PreferBlocStateSuffixRule
- Suggests that Bloc state classes end with 'State' suffix.
- PreferBlocTestPackageRule
- Warns when Bloc is tested without bloc_test package.
- PreferBlocTransformRule
- Warns when Bloc doesn't use transform for event debouncing/throttling.
- PreferBooleanPrefixesForLocalsRule
- Warns when local boolean variables are missing prefixes or suffixes.
- PreferBooleanPrefixesForParamsRule
- Warns when boolean parameters are missing prefixes.
- PreferBooleanPrefixesRule
- Warns when boolean field prefixes are missing (is/has/can/should/will/did).
- PreferBorderRadiusCircularRule
- Warns when BorderRadius.all(Radius.circular()) is used instead of
- PreferBothInliningAnnotationsRule
- PreferBranchIoOrFirebaseLinksRule
- Prefer Branch.io or Firebase Dynamic Links for deferred deep linking.
- PreferBroadcastStreamRule
- Warns when single-subscription Stream needs multiple listeners.
- PreferBuilderForConditionalRule
- Suggests using if/return instead of ternary for expensive widgets.
- PreferBuilderPatternRule
- Prefer builder pattern for complex object construction.
- PreferButtonStyleIconAlignmentRule
-
Detects deprecated
iconAlignmentparameter on button constructors. - PreferBytesBuilderRule
- Warns when duplicate patterns appear in pattern matching.
- PreferCachedGetterRule
- Warns when an expensive getter is called multiple times.
- PreferCachedImageCacheManagerRule
- Warns when CachedNetworkImage doesn't use a custom CacheManager.
- PreferCachedImageFadeAnimationRule
- Suggests explicitly setting fadeInDuration on CachedNetworkImage.
- PreferCachedNetworkImageRule
- Future rule: prefer-sliver-list-delegate
- PreferCachedPaintObjectsRule
- Warns when Paint() is created inside CustomPainter.paint() method.
- PreferCacheExtentRule
- Warns when ListView.builder or GridView.builder does not specify cacheExtent.
- PreferCamelCaseMethodNamesRule
- Warns when method names use underscores (non-private).
- PreferCameraResolutionSelectionRule
- Warns when CameraController is created without explicit resolution preset.
- PreferCancellationTokenPatternRule
- Prefer cancellation token (e.g. CancelToken in Dio) for cancelable operations.
- PreferCarouselViewRule
- Warns when using third-party carousel packages instead of CarouselView.
- PreferCascadeAssignmentsRule
- Prefer cascade (..) for consecutive assignments/calls to the same target.
- PreferCascadeOverChainedRule
- Warns when cascade could be used instead of chained calls for mutations.
- PreferCatchOverOnRule
-
Flags
on Object catchwhich is equivalent to a barecatch. - PreferCenterOverAlignRule
-
Warns when
Align(alignment: Alignment.center, ...)is used. - PreferChainedOverCascadeRule
- Warns when chained calls are preferred over cascade (opposite).
- PreferChangeNotifierProxyProviderRule
- Warns when ChangeNotifierProvider update accesses another provider directly.
- PreferChangeNotifierProxyRule
- Warns when Provider.of is used without listen: false in non-build contexts.
- PreferClassDestructuringRule
- Prefer record or pattern destructuring when extracting multiple fields.
- PreferClassOverRecordReturnRule
- Warns when methods return records instead of dedicated classes.
- PreferClipBehaviorRule
- Warns when widgets don't specify clipBehavior for performance.
- PreferClipboardFeedbackRule
- Warns when Clipboard.setData is used without user feedback.
- PreferClipRSuperellipseClipperRule
- Suggests using ClipRSuperellipse instead of ClipRRect when a custom
- PreferClipRSuperellipseRule
- Suggests using ClipRSuperellipse instead of ClipRRect for rounded corners.
- PreferClosestContextRule
- Prefer using the closest BuildContext (e.g. from the widget that owns the action).
- PreferCoarseLocationRule
- Warns when precise location is requested when coarse would suffice.
- PreferCodeUnitAtRule
-
Flags
string.codeUnits[index]and suggestsstring.codeUnitAt(index). - PreferCollectionIfOverTernaryRule
-
Warns when
cond ? [item] : []is used instead of[if (cond) item]. - PreferColorSchemeFromSeedRule
- Warns when scrollable widgets are nested without NestedScrollView.
- PreferCommentingAnalyzerIgnoresRule
-
Warns when
// ignore:comments don't have a preceding explanatory comment. - PreferCommentingFutureDelayedRule
- Warns when Future.delayed doesn't have a comment explaining why.
- PreferCompactClassMembersRule
- Warns when there ARE blank lines between members (opposite rule).
- PreferCompactDeclarationsRule
- Warns when there IS a blank line after declarations (opposite rule).
- PreferCompileTimeConfigRule
- Prefer compile-time configuration (e.g. --dart-define) over runtime-only config.
- PreferCompoundAssignmentOperatorsRule
- Warns when binary operators can be simplified to compound assignment.
- PreferComputeForHeavyWorkRule
- Warns when compute() should be used for heavy work.
- PreferComputeOverIsolateRunRule
- Warns when Isolate.run is used for simple computations.
- PreferConcatenationOverInterpolationRule
- Warns when interpolation is used instead of concatenation (opposite).
- PreferConciseVariableNamesRule
- Warns when variable names are too long (more than 30 characters).
- PreferConditionalExpressionsRule
- Warns when an if-else could be simplified to a conditional expression.
- PreferConditionalLoggingRule
- Prefer conditional logging so expensive message construction is not done when log level is disabled.
- PreferConnectivityDebounceRule
- Prefer debouncing connectivity stream listeners to avoid rapid rebuilds.
- PreferConstBorderRadiusRule
- Warns when non-const BorderRadius constructors are used.
- PreferConstConstructorDeclarationsRule
- Prefer declaring constructors as const when the class has only final fields.
- PreferConstConstructorsInImmutablesRule
- Warns when an @immutable class (e.g. StatelessWidget) has no const constructor.
- PreferConstDeclarationsRule
- Warns when a final variable could be const.
- PreferConstLiteralsToCreateImmutablesRule
- Warns when a non-const collection literal is passed to an @immutable constructor.
- PreferConstrainedBoxOverContainerRule
-
Warns when
Containeris used only for constraints. - PreferConstrainedGenericsRule
- Warns when generic type parameter is not constrained.
- PreferConstructorAssertionRule
- Warns when constructor assertion could be used instead of factory (opposite).
- PreferConstructorBodyAssignmentRule
- Warns when constructor body assignment could use initializing formals (opposite).
- PreferConstructorInjectionRule
- Warns when setter injection is used instead of constructor injection.
- PreferConstructorOverLiteralsRule
- Suggests List.empty()/Map()/Set.empty() over empty literals in some contexts.
- PreferConstructorsFirstRule
- Warns when a constructor appears after a method in a class.
- PreferConstructorsOverStaticMethodsRule
- Suggests named constructor over static factory method.
- PreferConstStringListRule
-
Warns when a
<String>[...]list literal with only string literals - PreferConstWidgetsInListsRule
- Warns when AnimationController is created without proper disposal.
- PreferConstWidgetsRule
- Warns when widgets that could be const are not declared as const.
- PreferConsumerOverProviderOfRule
-
Warns when
Provider.of<T>(context)is used in build method. - PreferConsumerWidgetRule
- Warns when Consumer widget is used instead of ConsumerWidget.
- PreferContainerOverSizedBoxRule
- Warns when SizedBox is used instead of Container (opposite rule).
- PreferContainerRule
- Warns when multiple decoration widgets could be a Container.
- PreferContainsRule
- Warns when indexOf is used to check for element presence.
- PreferContextMenuBuilderRule
-
Detects deprecated
previewBuilderparameter onCupertinoContextMenu. - PreferContextReadInCallbacksRule
- Suggests using context.read instead of context.watch in callbacks.
- PreferCopyWithForStateRule
- Warns when BLoC state is modified directly instead of using copyWith.
- PreferCorrectBlocProviderRule
- Warns when the wrong BlocProvider variant is used for the use case.
- PreferCorrectCallbackFieldNameRule
- Warns when callback fields don't follow onX naming convention.
- PreferCorrectEdgeInsetsConstructorRule
- Warns when incorrect EdgeInsets constructor is used.
- PreferCorrectErrorNameRule
- Warns when catch block parameter is not named 'e' or 'error'.
- PreferCorrectForLoopIncrementRule
-
Warns when a for loop uses a non-standard increment (e.g.
i += 2,i = i + 3). - PreferCorrectFutureReturnTypeRule
- Warns when Future-returning functions have incorrect return type annotations.
- PreferCorrectHandlerNameRule
- Warns when event handler names don't follow conventions.
- PreferCorrectIdentifierLengthRule
- Warns when identifier names are too short or too long.
- PreferCorrectJsonCastsRule
- Prefer proper type casts when working with JSON (null-safe).
- PreferCorrectPackageNameRule
-
Warns when a
librarydirective name doesn't follow Dart naming conventions. - PreferCorrectSetterParameterNameRule
- Warns when setter parameter is not named 'value'.
- PreferCorrectStreamReturnTypeRule
- Warns when Stream-returning functions have incorrect return type annotations.
- PreferCorrectSwitchLengthRule
- Warns when switch statements are too short or too long.
- PreferCorrectTestFileNameRule
- Warns when a test file doesn't follow naming conventions.
- PreferCorrectThrowsRule
-
Suggests documenting thrown exceptions with
@Throwsannotation. - PreferCorrectTopicsRule
- Prefer correct FCM topic format and subscription patterns.
- PreferCorrectTypeNameRule
- Warns when type names don't follow Dart conventions.
- PreferCsrfProtectionRule
- Warns when state-changing HTTP requests use Cookie auth without CSRF token.
- PreferCubitForSimpleRule
- Warns when Bloc is used for simple state that could use Cubit.
- PreferCubitForSimpleStateRule
- Suggests using Cubit instead of Bloc when only one event type exists.
- PreferCupertinoForIosFeelRule
- Warns when Scaffold body doesn't handle safe areas.
- PreferCupertinoForIosRule
- Quick fix that adds HapticFeedback.mediumImpact() to button callback. Suggests using Cupertino widgets in iOS-specific code blocks.
- PreferCurlyApostropheRule
- Warns when straight apostrophes are used instead of stylized (curly) apostrophes
- PreferCursorForButtonsRule
- Warns when buttons on web don't have mouse cursor configured.
- PreferCustomSingleChildLayoutRule
- Warns when WidgetsBinding.instance.addPostFrameCallback is not used properly.
- PreferDarkModeColorsRule
- Prefer theme-aware colors for dark mode support.
- PreferDataMaskingRule
- Warns when sensitive data is stored without encryption.
- PreferDateFormatRule
- Warns when raw DateTime formatting is used instead of DateFormat.
- PreferDeactivateForCleanupRule
- Prefer deactivate for cleanup when appropriate in widget lifecycle.
- PreferDebugPrintRule
- Suggests using debugPrint instead of print for better output throttling.
- PreferDeclaringConstConstructorRule
- Warns when a class could have a const constructor but doesn't.
- PreferDedicatedMediaQueryMethodRule
-
Warns when using
MediaQuery.of(context).sizeinstead of dedicated methods. - PreferDeepLinkAuthRule
- Prefer validating deep links and requiring auth when needed.
- PreferDefaultEnumCaseRule
- Warns when exhaustive cases is preferred over default (opposite).
- PreferDeferredImportsRule
- PreferDeferredLoadingWebRule
- Warns when large imports are not deferred on web.
- PreferDefineHeroTagRule
- Warns when setState is called in initState, dispose, or build.
- PreferDelayedPermissionPromptRule
- Suggests delaying permission prompt until user sees value.
- PreferDescriptiveBoolNamesRule
- Warns when boolean variables/parameters don't use descriptive prefixes.
- PreferDescriptiveBoolNamesStrictRule
- Quick fix that adds "is" prefix to boolean names.
- PreferDescriptiveTestNameRule
- Warns when test names don't follow the expected format.
- PreferDescriptiveVariableNamesRule
- Warns when variable names are too short (less than 3 characters) in non-trivial scopes.
- PreferDigitSeparatorsRule
- Warns when large numbers don't use digit separators.
- PreferDioBaseOptionsRule
- Warns when request options are repeated instead of using BaseOptions.
- PreferDioCancelTokenRule
- Warns when long-running Dio requests don't use CancelToken.
- PreferDioOverHttpRule
- Warns when using the http package instead of Dio.
- PreferDioTransformerRule
- Large JSON parsing should use custom transformer with isolates.
- PreferDiskCacheForPersistenceRule
- Prefer disk cache for persistence when data must survive process restarts.
- PreferDisposeBeforeNewInstanceRule
- Warns when a disposable field is reassigned without disposing the old value.
- PreferDocCommentsOverRegularRule
-
Warns when regular comments (
//) are used instead of doc comments (///) - PreferDocCurlyApostropheRule
- Warns when straight apostrophes are used instead of stylized (curly) apostrophes.
- PreferDocStraightApostropheRule
- Warns when stylized (curly) apostrophes are used instead of straight apostrophes
- PreferDotShorthandRule
- Warns when enum value could use Dart 3 dot shorthand.
- PreferDoubleQuotesRule
- Warns when double quotes are used instead of single quotes.
- PreferDriftBatchOperationsRule
- Warns when individual Drift inserts are called in a loop.
- PreferDriftForeignKeyDeclarationRule
-
Warns when an integer column in a Drift Table looks like a foreign key
but lacks a
.references()declaration. - PreferDriftIsolateSharingRule
- Warns when multiple NativeDatabase instances may use the same file.
- PreferDriftUseColumnsFalseRule
- Suggests using useColumns: false for join tables not read in results.
- PreferDropdownInitialValueRule
-
Detects deprecated
valueparameter onDropdownButtonFormField. - PreferDropdownMenuItemButtonOpacityAnimationRule
-
Flags redundant
opacityAnimation!and nullableCurvedAnimation? opacityAnimationonStatesubclasses forDropdownMenuItemButton. - PreferDurationConstantsRule
- Warns when Duration constructor can use cleaner units.
- PreferDynamicOverObjectRule
- Quick fix for PreferObjectOverDynamicRule.
- PreferEarlyReturnRule
- Warns when deeply nested if-else can be refactored to early returns.
- PreferEdgeInsetsOnlyRule
- Warns when EdgeInsets.symmetric() is used instead of .only() (opposite rule).
- PreferEdgeInsetsSymmetricRule
- Warns when EdgeInsets.only() could be simplified to EdgeInsets.symmetric().
- PreferElementRebuildRule
- Warns when widget types change conditionally, destroying Elements.
- PreferEncryptedPrefsRule
- Warns when sensitive data uses SharedPreferences instead of encrypted storage.
- PreferEnhancedEnumsRule
- Future rule: prefer-enhanced-enums
- PreferEnumsByNameRule
- Warns when enum values are found using firstWhere instead of byName.
- PreferEquatableMixinRule
- Warns when a class extends Equatable but could use EquatableMixin instead.
- PreferEquatableStringifyRule
- Warns when an Equatable class doesn't override stringify to true.
- PreferErrorSuffixRule
- Warns when Error suffix is preferred over Exception (opposite).
- PreferExceptionSuffixRule
- Warns when custom exception classes don't end with Exception suffix.
- PreferExhaustiveEnumsRule
- Warns when default case is used in enum switch instead of exhaustive cases.
- PreferExpandedAtCallSiteRule
- Warns when a widget's build() method returns Expanded/Flexible/Spacer.
- PreferExpandedOverFlexibleRule
- Warns when Flexible(fit: FlexFit.tight) is used instead of Expanded.
- PreferExpectLaterRule
- Warns when expect() is used with a Future instead of expectLater().
- PreferExpectOverAssertInTestsRule
- Warns when expect() is not used in tests (using assert instead).
- PreferExplicitBooleanComparisonRule
-
Warns when explicit
== trueis not used for nullable boolean expressions. - PreferExplicitColorsRule
- Warns when Theme.of(context).colorScheme is used instead of explicit Colors
- PreferExplicitFunctionTypeRule
- Warns when using bare 'Function' type instead of specific function type.
- PreferExplicitJsonKeysRule
- Warns when manual JSON key mapping is used instead of @JsonKey.
- PreferExplicitNullAssignmentRule
- Warns when explicit if-null-then-assign is preferred over ??= (opposite).
- PreferExplicitNullChecksRule
- Suggests explicit == null / != null over postfix ! when clearer.
- PreferExplicitParameterNamesRule
- Warns when function type parameters don't have names.
- PreferExplicitSemanticsRule
- Warns when custom widgets lack explicit Semantics wrapper.
- PreferExplicitThisRule
-
Warns when explicit
this.is not used for field access. - PreferExplicitTypeArgumentsRule
- Warns when generic types lack explicit type arguments.
- PreferExplicitTypesRule
-
Warns when
var,final(without type), ordynamicis used instead of - PreferExpressionBodyGettersRule
- Prefer arrow (=>) for simple getters.
- PreferExtensionMethodsRule
- Warns when a top-level function could be an extension method on its first parameter type.
- PreferExtensionOverUtilityClassRule
- Warns when a class with only static methods (utility class) could be an extension.
- PreferExtensionSuffixRule
- Warns when extension name does not end with Ext.
- PreferExtensionTypeForWrapperRule
- Warns when a single-field wrapper class could be an extension type (Dart 3.3+).
- PreferExternalKeyboardRule
- PreferExtractingCallbacksRule
- Warns when inline callbacks could be extracted to methods.
- PreferExtractingFunctionCallbacksRule
- Warns when inline function callbacks should be extracted.
- PreferExtractingRepeatedMapLookupRule
- Flags repeated identical map lookups within the same function body.
- PreferFactoryBeforeNamedRule
- Warns when a named constructor appears before a factory constructor.
- PreferFactoryConstructorRule
- Prefer factory constructor over static method that returns an instance of the same class.
- PreferFactoryForValidationRule
- Warns when factory constructor could be used for validation.
- PreferFakeOverMockRule
- Warns when tests use excessive mocking instead of simpler fakes.
- PreferFakePlatformRule
- Warns when platform channels are used without fakes in tests.
- PreferFamilyForParamsRule
- Warns when ref.watch is used with .family without proper parameter.
- PreferFeatureFolderStructureRule
- Warns when complex positioning uses nested widgets instead of CustomSingleChildLayout.
- PreferFieldsBeforeMethodsRule
- Warns when fields are not declared before methods.
- PreferFinalClassRule
-
Warns when a concrete class could be marked
final. - PreferFinalFieldsAlwaysRule
- All instance fields should be final.
- PreferFinalFieldsRule
- Warns when a class field is never reassigned and could be final.
- PreferFinalLocalsRule
- Prefer final for local variables that are never reassigned.
- PreferFindChildIndexCallbackRule
- Prefer findChildIndexCallback in ListView.builder for stable indices.
- PreferFireAndForgetRule
- Suggests fire-and-forget (unawaited) when the Future result is not used.
- PreferFirebaseAuthPersistenceRule
- Warns when Firebase Auth on web doesn't set persistence to LOCAL.
- PreferFirebaseRemoteConfigDefaultsRule
- Warns when RemoteConfig is used without setting defaults.
- PreferFirebaseTransactionForCountersRule
- Prefer Firestore transactions for counter updates to avoid race conditions.
- PreferFirestoreBatchWriteRule
- Warns when multiple individual Firestore writes could be batched.
- PreferFirstRule
-
Warns when
list[0]is used instead oflist.first. - PreferFitCoverForBackgroundRule
- Warns when background images don't use BoxFit.cover.
- PreferFixmeFormatRule
- Warns when FIXME comments don't follow the standard format.
- PreferFlatImportsRule
- Warns when imports are grouped (opposite - prefers flat import list).
- PreferFlavorConfigurationRule
- Prefer flavor-based configuration for multi-environment apps.
- PreferFlexForComplexLayoutRule
-
Warns when
TextFieldorTextFormFieldis placed inside aRow - PreferFlexibleOverExpandedRule
- Warns when Expanded is used instead of Flexible (opposite rule).
- PreferFocusTraversalOrderRule
- Warns when complex forms don't specify focus traversal order.
- PreferFoldOverReduceRule
- Prefer fold over reduce for collections when an initial value is needed.
- PreferForeachOverMapEntriesRule
- Suggests for-in over map.entries when iterating map entries.
- PreferForeachRule
- Suggests for-in loop over .forEach(callback) for readability and control flow.
- PreferForegroundServiceAndroidRule
- Warns when long-running background work lacks a foreground service.
- PreferForElementsToMapFromIterableRule
-
Warns when
Map.fromIterablecan be replaced with a for-element map literal. - PreferForInRule
- Warns when an index-based for loop iterating over a collection can be replaced with a for-in loop.
- PreferForLoopInChildrenRule
- Warns when List.generate is used in widget children.
- PreferFormBlocForComplexRule
- Forms with >5 fields benefit from form state management (FormBloc, etc.).
- PreferFoundationPlatformCheckRule
- Warns when Platform is used in widget context instead of defaultTargetPlatform.
- PreferFractionalSizingRule
- Warns when percentage-based sizing uses hardcoded calculations.
- PreferFreezedDefaultValuesRule
- Warns when Freezed nullable fields could use @Default annotation instead.
- PreferFreezedForDataClassesRule
- Warns when data classes could benefit from using freezed.
- PreferFreezedUnionTypesRule
- Prefer Freezed union types for sealed state instead of manual class hierarchies.
- PreferFunctionOverStaticMethodRule
- Prefer top-level function over static method when the method does not use instance state.
- PreferFutureVoidFunctionOverAsyncCallbackRule
-
Quick fix that replaces
VoidCallbackwithFuture<void> Function(). - PreferFutureWaitRule
- Warns when sequential awaits could use Future.wait for parallelism.
- PreferGenericExceptionRule
- Warns when specific exceptions are used instead of generic (opposite).
- PreferGeocodingCacheRule
- Warns when reverse geocoding is called without caching results.
- PreferGeolocationCoarseLocationRule
- Prefer coarse location when high accuracy is not needed (battery and privacy).
- PreferGeolocatorAccuracyAppropriateRule
- Use appropriate location accuracy level - high accuracy drains battery.
- PreferGeolocatorDistanceFilterRule
- Warns when Geolocator location stream doesn't specify distanceFilter.
- PreferGeolocatorLastKnownRule
- Use lastKnownPosition for non-critical needs to save battery.
- PreferGetterOverMethodRule
- Future rule: prefer-getter-over-method
- PreferGettersBeforeSettersRule
- Prefer getter declared before setter when both exist for the same name.
- PreferGetxBuilderOverObxRule
- Prefer GetBuilder over Obx when reactivity is not needed.
- PreferGetxBuilderRule
- Warns when .obs property is accessed without Obx wrapper.
- PreferGivenWhenThenCommentsRule
- Warns when tests don't use Given/When/Then or Arrange/Act/Assert comments.
- PreferGoRouterBuilderRule
- Prefer go_router_builder for compile-time route safety.
- PreferGoRouterExtraTypedRule
- Warns when go_router extra parameter is Map or dynamic instead of typed.
- PreferGoRouterRedirectAuthRule
- Suggests using go_router redirect instead of auth checks in page builders.
- PreferGoRouterRedirectRule
- Warns when GoRouter is created without a redirect callback.
- PreferGracePeriodHandlingRule
- Warns when IAP purchase verification ignores grace period status.
- PreferGroupedByPurposeRule
- Warns when parameters should be grouped by purpose (opposite).
- PreferGroupedExpectationsRule
- Warns when tests should have multiple grouped expectations (opposite).
- PreferGroupedImportsRule
- Warns when imports are not grouped by type (dart, package, relative).
- PreferGuardClausesRule
- Warns when guard clauses could be used at function start.
- PreferHackFormatRule
- Reports comment lines that start with "// HACK :" so they appear in the extension's Issues tree.
- PreferHighContrastModeRule
- Prefer high-contrast-aware styling for accessibility.
- PreferHiveCompactPeriodicallyRule
- Suggests calling box.compact() after bulk deletes to reclaim space.
- PreferHiveCompactRule
- Suggests periodic compaction for Hive boxes that are written to.
- PreferHiveEncryptionRule
- Warns when Hive stores sensitive data without encryption.
- PreferHiveLazyBoxRule
- Warns when Box is used instead of LazyBox for potentially large collections.
- PreferHiveValueListenableRule
- Use box.listenable() with ValueListenableBuilder for reactive UI.
- PreferHiveWebAwareRule
- Suggests web-aware Hive initialization when targeting web.
- PreferHtmlEscapeRule
- Warns when user content is displayed in WebViews without HTML escaping.
- PreferHttpConnectionReuseRule
- Warns when HTTP clients are created without connection reuse.
- PreferIfElementsToConditionalExpressionsRule
- Prefer if element over ternary with null in collection literals.
- PreferIfElseOverGuardsRule
- Prefer if-else over guard clauses for certain logic (opinionated).
- PreferIfNullOverTernaryRule
-
Warns when
x != null ? x : defaultis used instead ofx ?? default. - PreferIgnorePointerRule
- Suggests IgnorePointer when AbsorbPointer may not be needed.
- PreferImageCroppingRule
- Warns when image picker is used for profile photos without cropping.
- PreferImageFilterQualityMediumRule
-
Suggests
FilterQuality.mediuminstead ofFilterQuality.lowon Flutter image APIs, matching Flutter 3.24 defaults (PR #148799). - PreferImagePickerMaxDimensionsRule
- Warns when ImagePicker.pickImage() is called without maxWidth/maxHeight.
- PreferImagePickerMultiSelectionRule
- Use pickMultiImage instead of loop calling pickImage.
- PreferImagePickerRequestFullMetadataRule
- Warns when pickImage is called without requestFullMetadata: false.
- PreferImagePrecacheRule
- Warns when images should be precached for smooth display.
- PreferImageSizeConstraintsRule
- Warns when Image lacks cacheWidth/cacheHeight for memory optimization.
- PreferImmediateReturnRule
- Warns when a variable is declared and immediately returned.
- PreferImmutableAnnotationRule
- Warns when an Equatable class is not annotated with @immutable.
- PreferImmutableBlocEventsRule
- Warns when Bloc event classes have mutable fields.
- PreferImmutableBlocStateRule
- Warns when Bloc state classes have mutable fields.
- PreferImmutableProviderArgumentsRule
-
Suggests marking provider function arguments as
final. - PreferImmutableSelectorValueRule
- Warns when mutable values are used in Provider Selector.
- PreferImplicitAnimationsRule
- Warns when explicit AnimationController is used for simple transitions.
- PreferImplicitBooleanComparisonRule
-
Warns when
== trueis used for boolean expressions. - PreferImplSuffixRule
- Warns when a class that implements an interface does not end with Impl.
- PreferImportGroupCommentsRule
- Warns when import groups lack doc-comment section headers.
- PreferImportOverPartRule
- Prefer import over part for modularity and clearer dependencies.
- PreferInfiniteScrollPreloadRule
- Warns when infinite scroll triggers loading only at 100% scroll extent.
- PreferInheritedWidgetCacheRule
- Warns when same InheritedWidget is accessed multiple times in a method.
- PreferInitializingFormalsRule
- Warns when initializing formals could be used.
- PreferInjectablePackageRule
- Suggests using injectable package for DI code generation.
- PreferInkwellOverGestureRule
- Warns when GestureDetector is used with only onTap.
- PreferInlineCallbacksRule
- Warns when callbacks are extracted to separate methods/variables.
- PreferInlinedAddsRule
- Prefer inline collection literal over empty literal followed by add/addAll.
- PreferInlineFunctionTypesRule
- Prefer inline function types over typedef for function types.
- PreferInputFormattersRule
- Warns when text fields with numeric/phone keyboard lack inputFormatters.
- PreferInstanceMembersFirstRule
- Warns when instance members are not declared before static members (opposite).
- PreferInterfaceClassRule
-
Warns when an abstract class with only abstract members could be
interface. - PreferInternetConnectionCheckerRule
- Suggests internet_connection_checker for actual internet verification.
- PreferInterpolationOverConcatenationRule
- Warns when string concatenation is used instead of interpolation.
- PreferInterpolationToComposeRule
- Prefer string interpolation over + concatenation with string literals.
- PreferIntlMessageDescriptionRule
- Intl.message should include description for translators.
- PreferIntlNameRule
- Warns when Intl.message lacks the name parameter.
- PreferIntrinsicDimensionsRule
- Suggests RefreshIndicator for lists that appear to show remote data.
- PreferIosAppIntentsFrameworkRule
- Warns when iOS App Intents framework should be considered.
- PreferIosContextMenuRule
- Suggests supporting Dynamic Type (large text) on iOS.
- PreferIosHandoffSupportRule
- Suggests implementing iOS Handoff for continuity between devices.
- PreferIosHapticFeedbackRule
- Quick fix that replaces hardcoded value with MediaQuery.padding.top. Suggests adding haptic feedback for important button interactions on iOS.
- PreferIosSafeAreaRule
- PreferIosSpotlightIndexingRule
- Suggests implementing Spotlight search indexing.
- PreferIosStoreKit2Rule
- Warns when background audio capability may be needed.
- PreferIPrefixInterfacesRule
- Warns when abstract class (used as interface) name does not start with I.
- PreferIsarAsyncWritesRule
- Warns when writeTxnSync is used in build methods.
- PreferIsarBatchOperationsRule
- Warns when put() is called in a loop instead of putAll().
- PreferIsarCompositeIndexRule
- Warns when multi-field queries lack composite indexes.
- PreferIsarForComplexQueriesRule
- PreferIsarIndexForQueriesRule
- Warns when querying fields that should be indexed.
- PreferIsarLazyLinksRule
- Warns when IsarLinks is used without .lazy for large collections.
- PreferIsarQueryStreamRule
- Warns when Timer-based polling is used instead of Isar's watch().
- PreferIsNanOverNanEqualityRule
-
Flags
x == double.nan(always false) andx != double.nan(always true). - PreferIso8601DatesRule
- Warns when non-ISO 8601 date formats are used for serialization.
- PreferItemExtentRule
- Warns when ListView with uniform items doesn't specify itemExtent.
- PreferItemExtentWhenKnownRule
- Quick fix for PreferLoggerOverPrintRule.
- PreferIterableCastRule
-
Flags
Iterable.castFrom(x)and suggestsx.cast<T>()instead. - PreferIterableOfRule
- Warns when List.from/Set.from/Map.from is used instead of .of constructors.
- PreferIterableOperationsRule
- Warns when iterable operations chain to List when lazy iteration suffices.
- PreferJsInteropOverDartJsRule
-
Prefer stable
dart:js_interop(Dart 3.5+) over deprecateddart:js/dart:js_util. - PreferJsonCodegenRule
- Suggests json_serializable or freezed for JSON serialization.
- PreferJsonSerializableRule
- Warns when data classes have manual JSON serialization.
- PreferKeepaliveDisposeRule
-
Detects deprecated
release()method onKeepAliveHandle. - PreferKeepAliveRule
- Warns when StatefulWidget doesn't use AutomaticKeepAliveClientMixin
- PreferKeyboardListenerOverRawRule
-
Flags usage of the deprecated
RawKeyboardListenerwidget. - PreferKeyboardShortcutsRule
- Warns when desktop apps don't set window size constraints.
- PreferKeyEventRule
-
Detects deprecated
RawKeyEvent/RawKeyboardAPI usage. - PreferKeysIterationRule
- Warns when .keys iteration is preferred over .entries (opposite rule).
- PreferLargeTouchTargetsRule
- Touch targets should be at least 48x48 logical pixels for accessibility.
- PreferLastRule
-
Warns when
list[length-1]is used instead oflist.last. - PreferLateFinalRule
- Warns when the same string literal appears 3 or more times in a file.
- PreferLateLazyInitializationRule
- Suggests late for expensive lazy initialization.
- PreferLateOverNullableRule
-
Warns when
latecould be used instead of nullable type for lazy init. - PreferLayoutBuilderForConstraintsRule
- Suggests LayoutBuilder for constraint-aware layout instead of MediaQuery sizing.
- PreferLayoutBuilderOverMediaQueryRule
- Warns when MediaQuery.of is used inside ListView item builder.
- PreferLazyBoxForLargeRule
- Warns when large data is loaded into regular Hive boxes instead of lazy.
- PreferLazyLoadingImagesRule
- Warns when images are loaded without lazy loading in scrollable views.
- PreferLazySingletonRegistrationRule
- Warns when eager singleton registration is used for expensive objects.
- PreferListenableBuilderRule
-
Warns when
AnimatedBuilderis given a plainListenable(not anAnimation) and recommendsListenableBuilderinstead. - PreferListViewBuilderRule
- Future rule: prefer-cached-network-image
- PreferLocalAuthRule
- Warns when Uri.parse is used on user input without scheme validation.
- PreferLocalNotificationForImmediateRule
- Prefer flutter_local_notifications for app-generated notifications; FCM for server.
- PreferLoggerOverPrintRule
- Warns when print() is used instead of proper logging.
- PreferLogLevelsRule
- Suggests using multiple log levels appropriately.
- PreferLogTimestampRule
- Suggests including timestamps in log output.
- PreferLowerCamelCaseConstantsRule
- Quick fix for PreferDynamicOverObjectRule.
- PreferLowercaseConstantsRule
- Prefer lowerCamelCase for const and static final constants.
- PreferLruCacheRule
- Suggests LRU cache for memory-bounded caches.
- PreferM3TextThemeRule
-
Detects deprecated 2018-era
TextThememember names. - PreferMacosKeyboardShortcutsRule
- Suggests implementing standard macOS keyboard shortcuts.
- PreferMacosMenuBarIntegrationRule
- Suggests using PlatformMenuBar for native macOS menu integration.
- PreferMapEntriesIterationRule
- Warns when iterating map with .keys and lookup vs .entries.
- PreferMarkerClusteringRule
- Warns when many individual map markers are used without clustering.
- PreferMasterDetailForLargeRule
- On tablets, list-detail flows should use master-detail (two-pane) layout.
- PreferMatcherOverEqualsRule
- Warns when expect uses equality instead of matchers.
- PreferMatchFileNameRule
- Warns when the file name doesn't match the primary class/type name.
- PreferMaterialThemeColorsRule
- Warns when hardcoded colors are used instead of Theme.of(context).colorScheme.
- PreferMaybePopRule
- Warns when Navigator.pop() is used without checking if it can pop.
- PreferMergeSemanticsRule
- Warns when Icon and Text are adjacent without MergeSemantics.
- PreferMethodsBeforeFieldsRule
- Warns when methods are not declared before fields (opposite).
- PreferMixinOverAbstractRule
- Prefer mixin over abstract class when used purely for code sharing.
- PreferMixinPrefixRule
- Warns when mixin name does not end with Mixin.
- PreferMockHttpRule
- Warns when real HTTP client is used in tests.
- Warns when Navigator is used in tests without mocking.
- PreferMockVerifyRule
- Warns when mock verify() is not used to check method calls.
- PreferMovingToVariableRule
- Warns when an expression is repeated and could be extracted to a variable.
- PreferMultiBlocProviderRule
-
Warns when nested
BlocProviderwidgets are used. - PreferMultiProviderRule
-
Warns when nested
Providerwidgets are used. - PreferMutableCollectionsRule
- Warns when UnmodifiableListView is preferred over mutable (opposite rule).
- PreferNamedBooleanParametersRule
- Warns when boolean parameters are positional instead of named.
- PreferNamedBoolParamsRule
- Warns when string concatenation with + is used where string interpolation
- PreferNamedExtensionsRule
- Future rule: prefer-named-extensions
- PreferNamedImportsRule
- Warns when imports should use named imports for clarity.
- PreferNamedParametersRule
- Warns when a function has many positional parameters.
- PreferNamedRoutesForDeepLinksRule
- Suggests named routes so that deep links can open the correct screen.
- PreferNativeFileDialogsRule
- Warns when custom file dialog is used instead of native on desktop.
- PreferNeverOverAlwaysThrowsRule
-
Flags the deprecated
@alwaysThrowsannotation; preferNeverreturn type. - PreferNoBlankLineBeforeReturnRule
- Warns when there IS a blank line before return (opposite rule).
- PreferNoBlankLineInsideBlocksRule
- Warns when there are blank lines at the start/end of blocks.
- PreferNoIPrefixInterfacesRule
- Warns when abstract class name starts with I (opposite style).
- PreferNonConstConstructorsRule
- Suggests non-const constructor when const is not required (stylistic opposite).
- PreferNotificationCustomSoundRule
- Suggests documenting or configuring custom sound for important notifications.
- PreferNotificationGroupingRule
- Warns when multiple notifications are shown without grouping.
- PreferNotifierOverStateRule
- Warns when StateProvider is used instead of StateNotifierProvider/Notifier.
- PreferNounClassNamesRule
- Prefer noun/agent class names over gerund (-ing) or adjective (-able/-ible).
- PreferNullableOverLateRule
- Warns when late is used instead of nullable (opposite rule).
- PreferNullableProviderTypesRule
- Warns when Provider type parameter is non-nullable but create returns null.
- PreferNullAwareAssignmentRule
-
Warns when
if (x == null) x = valueis used instead ofx ??= value. - PreferNullAwareElementsRule
- Warns when collections handle nullable items without null-aware spread.
- PreferNullAwareMethodCallsRule
- Prefer null-aware call (?.) over explicit null check then call.
- PreferNullAwareSpreadRule
- Warns when spreading a nullable collection without null-aware spread.
- PreferNullObjectPatternRule
- Warns when optional dependencies use null instead of null object pattern.
- PreferNumberFormatRule
- Warns when numbers are displayed without proper formatting.
- PreferOauthPkceRule
- Warns when OAuth authorization flows lack PKCE (Proof Key for Code Exchange) parameters.
- PreferObjectOverDynamicRule
-
Warns when
dynamicis used instead ofObject?. - PreferOneWidgetPerFileRule
- Warns when multiple widget classes are defined in a single file.
- PreferOnFieldSubmittedRule
- Warns when form fields lack onFieldSubmitted handler.
- PreferOnOverCatchRule
-
Warns when
on SpecificExceptionis preferred over barecatch (e). - PreferOnPopWithResultRule
-
Detects usage of the deprecated
onPopcallback on routes. - PreferOpacityWidgetRule
- Future rule: avoid-stateful-widget-in-list
- PreferOptimisticUpdatesRule
- Warns when setState is called after an await expression.
- PreferOptionalNamedParamsRule
- Prefer optional named parameters over optional positional for clarity.
- PreferOptionalPositionalParamsRule
- Prefer optional positional parameters over optional named for simple flags.
- PreferOutlinedIconsRule
- PreferOverflowBarOverButtonBarRule
-
Flags
ButtonBar,ButtonBarThemeData, andThemeData.buttonBarThemein favor ofOverflowBar-centric layouts (Flutter 3.13 / 3.24 migration). - PreferOverlayPortalLayoutBuilderRule
- Suggests OverlayPortal.overlayChildLayoutBuilder for unconstrained overlays.
- PreferOverlayPortalRule
- Warns when using OverlayEntry instead of the declarative OverlayPortal.
- PreferOverridesLastRule
- Warns when an override method appears before a non-override method.
- PreferOverridingParentEqualityRule
- Warns when type arguments can be inferred and are redundant.
- PreferPaddingOverContainerRule
-
Warns when
Containeris used only for padding. - PreferPageStorageKeyRule
- Warns when GestureDetector is used without specifying HitTestBehavior.
- PreferPaginationRule
- Warns when APIs return large collections without pagination.
- PreferPanAxisRule
-
Detects deprecated
alignPanAxisparameter onInteractiveViewer. - PreferParenthesesWithIfNullRule
- Warns when if-null operator (??) is used without parentheses in
- PreferPartOverImportRule
- PreferPatternDestructuringRule
- Warns when multiple positional record accesses could use destructuring.
- PreferPendingIntentFlagsRule
- Warns when PendingIntent is created without FLAG_IMMUTABLE or FLAG_MUTABLE.
- PreferPeriodAfterDocRule
- Warns when doc comments don't end with a period.
- PreferPermissionMinimalRequestRule
- Suggests requesting only the permissions actually used.
- PreferPermissionRequestInContextRule
- Warns when permissions are requested at app startup instead of in context.
- PreferPhysicsSimulationRule
- Warns when drag-release interaction doesn't use physics simulation.
- PreferPlatformIoConditionalRule
- Warns when Platform is used for web checks instead of kIsWeb.
- PreferPlatformMenuBarChildRule
-
Detects deprecated
bodyparameter onPlatformMenuBar. - PreferPlatformWidgetAdaptiveRule
- Suggests platform-adaptive widgets for cross-platform apps.
- PreferPoolPatternRule
- Prefer object pools for high-frequency allocations in hot loops.
- PreferPositionalBoolParamsRule
- Prefer positional boolean parameters (optional) over named for call-site brevity.
- PreferPositionedDirectionalRule
- Warns when scrollable lists should have a ScrollController.
- PreferPositiveConditionsFirstRule
- Warns when a negated condition is used in a guard clause instead of the positive form.
- PreferPositiveConditionsRule
- Warns when an if/else or ternary uses a negative condition.
- PreferPrefixedGlobalConstantsRule
- Warns when global constants don't have a prefix.
- PreferPrivateExtensionTypeFieldRule
- Warns when extension type representation fields are public.
- PreferPrivateMembersFirstRule
- Warns when private members are not declared before public members (opposite).
- PreferPrivateUnderscorePrefixRule
- Warns when private fields don't use underscore prefix consistently.
- PreferPrototypeItemRule
- Warns when ListView doesn't use prototypeItem for consistent sizing.
- PreferProviderExtensionsRule
- Warns when long Provider access chains are used.
- PreferProvidingIntlDescriptionRule
- Quick fix for PreferIntlNameRule.
- PreferProvidingIntlExamplesRule
- Quick fix for PreferProvidingIntlDescriptionRule.
- PreferProxyProviderRule
- Warns when Provider depends on another provider but doesn't use ProxyProvider.
- PreferPublicExceptionClassesRule
- Warns when exception classes are private.
- PreferPublicMembersFirstRule
- Warns when public members are not declared before private members.
- PreferPumpAndSettleRule
- Suggests using pumpAndSettle() after user interactions in widget tests.
- PreferPushingConditionalExpressionsRule
- Warns when a ternary expression can be pushed into arguments.
- PreferRawStringsRule
- Prefer raw string literals when the string contains only escaped backslashes.
- PreferReadableLineLengthRule
- Suggests keeping lines under ~80 characters for readability.
- PreferRecordOverEquatableRule
- Warns when a simple Equatable class could be replaced with a Dart 3 record.
- PreferRecordOverTupleClassRule
- Prefer record type over simple tuple-like class (Dart 3+).
- PreferRedirectingSuperclassConstructorRule
- Suggests using redirecting constructors for super calls.
- PreferRefWatchOverReadRule
- Warns when ref.read is used instead of ref.watch in build methods.
- PreferRegexValidationRule
- Warns when form fields use basic validators instead of regex patterns.
- PreferRelativeImportsRule
- Warns when absolute imports are used instead of relative imports.
- PreferRequiredBeforeOptionalRule
- Warns when required parameters come after optional parameters.
- PreferResultPatternRule
- Warns when Result pattern is not used for expected failures.
- PreferResultTypeRule
- Prefer explicit return type on function declarations.
- PreferRethrowOverThrowERule
- Warns when rethrow is not used to preserve stack trace.
- PreferReturnAwaitRule
- Warns when a Future is returned without await in an async function.
- PreferReturningConditionalExpressionsRule
- Quick fix: Simplifies boolean literal comparisons. Return conditional expressions directly instead of if/else blocks.
- PreferReturningConditionalsRule
- Warns when returning a conditional could be simplified.
- PreferReturningConditionRule
-
Warns when using
if (x) return true; else return false;instead ofreturn x;. - PreferReturningShorthandsRule
- Warns when arrow function could be used instead of block.
- PreferRichTextForComplexRule
- Warns when multiple adjacent Text widgets could use Text.rich or RichText.
- PreferRichTextOverTextRichRule
- Warns when Text.rich() is used instead of RichText (opposite rule).
- PreferRiverpodAutoDisposeRule
- Providers should use autoDispose to free memory when unused.
- PreferRiverpodCodeGenRule
- Suggests @riverpod annotation for type-safe providers.
- PreferRiverpodFamilyForParamsRule
- Providers with parameters should use .family modifier.
- PreferRiverpodKeepAliveRule
- Suggests ref.keepAlive() for long-lived provider state.
- PreferRiverpodSelectRule
- Warns when ref.watch is used to access only one field.
- PreferRootDetectionRule
- Warns when stack traces are exposed to users in production code.
- PreferRouteSettingsNameRule
- Warns when RouteSettings.name is not provided for analytics tracking.
- PreferRxdartForComplexStreamsRule
- Suggests RxDart for complex stream transformations.
- PreferSafeAreaAwareRule
- Warns when Scaffold body content may overlap device notches or system UI.
- PreferSafeAreaConsumerRule
- Prefer letting Scaffold consume safe area instead of wrapping body in SafeArea.
- PreferScaffoldMessengerMaybeOfRule
- Future rule: prefer-scaffold-messenger-maybeof
- PreferScalableTextRule
- Warns when text uses fixed pixel sizes that don't scale with system settings.
- PreferScheduleMicrotaskOverWindowPostmessageRule
-
Prefer
scheduleMicrotaskoverwindow.postMessage('', '*')for same-thread deferral on the web. - PreferScreamingCaseConstantsRule
- Warns when constants don't use SCREAMING_SNAKE_CASE.
- PreferSealedBlocEventsRule
- Warns when Bloc event classes are not sealed.
- PreferSealedBlocStateRule
- Warns when Bloc state classes are not sealed.
- PreferSealedClassesRule
- Prefer sealed class when abstract class has multiple concrete subclasses in the same file.
- PreferSealedEventsRule
- Warns when BLoC events don't use sealed classes.
- PreferSealedForStateRule
- Prefer sealed for state/event/result hierarchies (BLoC, Cubit, etc.).
- PreferSearchAnchorRule
- Warns when using showSearch/SearchDelegate instead of SearchAnchor.
- PreferSecureRandomForCryptoRule
- Warns when Random() is used for cryptographic purposes.
- PreferSecureRandomRule
- Warns when Random() is used instead of Random.secure().
- PreferSelectableTextRule
- Warns when SizedBox.expand() is used.
- PreferSelectForPartialRule
- Warns when using ref.watch() for entire provider when only part is needed.
- PreferSelectorOverConsumerRule
- Suggests using Selector instead of Consumer for granular rebuilds.
- PreferSelectorRule
-
Warns when
context.watch<T>()is used withoutselect(). - PreferSelectorWidgetRule
- Warns when Consumer/Selector rebuilds entire subtree unnecessarily.
- PreferSelfDocumentingTestsRule
- Warns when AAA/GWT comments are used (prefer self-documenting tests).
- PreferSemanticsContainerRule
-
Warns when Semantics wraps grouped widgets without
container: true. - PreferSemanticsSortRule
- Suggests sortKey on Semantics for complex layouts so screen reader order is correct.
- PreferSemanticWidgetNamesRule
- PreferSemverVersionRule
- Warns when pubspec.yaml version does not follow semantic versioning.
- PreferSentenceCaseCommentsRelaxedRule
- Warns when comments of 5+ words don't start with a capital letter.
- PreferSentenceCaseCommentsRule
- Warns when comments of 3+ words don't start with a capital letter.
- PreferSeparateAssignmentsRule
- Suggests separate assignments over cascade for assignments.
- PreferSetForLookupRule
- Quick fix that removes a duplicate element from a collection. Warns when a List is used for frequent contains() checks.
- PreferSetupTeardownRule
- Warns when test setup code is duplicated instead of using setUp/tearDown.
- Warns when legacy SharedPreferences API is used instead of SharedPreferencesAsync.
- PreferShellRouteForPersistentUiRule
- Warns when persistent UI elements aren't using ShellRoute.
- Use ShellRoute for shared AppBar/BottomNav instead of duplicating Scaffold.
- PreferShorthandsWithConstructorsRule
-
Warns when
.newconstructor shorthand can be used. - PreferShorthandsWithEnumsRule
- Warns when enum shorthand can be used.
- PreferShorthandsWithStaticFieldsRule
- Warns when static field shorthand can be used.
- PreferShowHideRule
- PreferSimplerBooleanExpressionsRule
- Warns when boolean expressions can be simplified using De Morgan's laws
- PreferSimplerPatternsNullCheckRule
- Warns when pattern null checks can be simplified.
- PreferSingleAssertionRule
- Warns when a test has multiple assertions testing different behaviors.
- PreferSingleBlankLineMaxRule
- Warns when there are two or more consecutive blank lines anywhere in a file.
- PreferSingleDeclarationPerFileRule
- Warns when a file contains multiple top-level declarations.
- PreferSingleExitPointRule
- Warns when early return is used instead of single exit point (opposite).
- PreferSingleExpectationPerTestRule
- Warns when tests have multiple logical assertions.
- PreferSingleQuotesRule
- Warns when double quotes are used instead of single quotes for strings.
- PreferSingleSetStateRule
- Warns when multiple setState calls are made in the same method.
- PreferSingleWidgetPerFileRule
- Warns when a file contains multiple public widget classes.
- PreferSizedBoxForWhitespaceRule
- Warns when dependOnInheritedWidgetOfExactType is called in initState.
- PreferSizedBoxOverContainerRule
- Warns when Container is used for simple width/height spacing.
- PreferSizedBoxSquareRule
-
Warns when
SizedBox(width: X, height: X)with identical dimensions is used. - PreferSkeletonOverSpinnerRule
- Warns when CircularProgressIndicator is used for content loading.
- PreferSliverAppBarRule
- Warns when AppBar is used inside CustomScrollView instead of SliverAppBar.
- PreferSliverFillRemainingForEmptyRule
- Warns when empty state widgets in CustomScrollView are not wrapped in SliverFillRemaining.
- PreferSliverForMixedScrollRule
- Suggests CustomScrollView with slivers when mixing scroll and non-scroll content.
- PreferSliverListDelegateRule
- Future rule: avoid-mediaquery-in-build
- PreferSliverListRule
- Warns when ListView is used inside CustomScrollView instead of SliverList.
- PreferSliverPrefixRule
- Warns when a State class has a constructor body.
- PreferSmallFilesRule
- OPINIONATED: Suggests keeping files under 200 lines for maximum
- PreferSmallTestFilesRule
- OPINIONATED: Suggests keeping test files under 400 lines.
- PreferSnakeCaseFilesRule
- Warns when Dart file names don't use snake_case.
- PreferSortedImportsRule
- Warns when imports within a group are not sorted alphabetically.
- PreferSortedParametersRule
- Warns when function parameters are not in alphabetical order.
- PreferSpacingOverSizedBoxRule
- Warns when long Text could be SelectableText.
- PreferSpecificCasesFirstRule
- Warns when test assertions could use more specific matchers.
- PreferSpecificExceptionsRule
- Warns when generic Exception is thrown instead of specific type.
- PreferSpecificNumericTypesRule
- Warns when num is used instead of int or double.
- PreferSpecifyingFutureValueTypeRule
- Warns when Future.value() is called without explicit type argument.
- PreferSplitWidgetConstRule
- Future rule: prefer-split-widget-const
- PreferSpreadOverAddAllRule
- Warns when .addAll() is used instead of spread operator.
- PreferSpringAnimationRule
- Suggests using SpringSimulation instead of CurvedAnimation for
- PreferSqfliteBatchRule
- Warns when sqflite uses individual inserts in a loop instead of batch.
- PreferSqfliteColumnConstantsRule
- Use constants for column names to avoid typos.
- PreferSqfliteEncryptionRule
- Warns when sqflite is used for potentially sensitive data without encryption.
- PreferSqfliteSingletonRule
- Use singleton database instance instead of multiple openDatabase calls.
- PreferStaleWhileRevalidateRule
- Suggests stale-while-revalidate cache pattern for API data.
- PreferStaticBeforeInstanceRule
- Prefer static members declared before instance members of the same category.
- PreferStaticClassRule
- Warns when a class only has static members and could be a namespace.
- PreferStaticConstWidgetsRule
- Warns when widgets could be static const for better performance.
- PreferStaticMembersFirstRule
- Warns when static members are not declared before instance members.
- PreferStaticMethodOverFunctionRule
- Prefer static method or extension over top-level function when the function's first parameter is a class type.
- PreferStaticMethodRule
-
Warns when an instance method doesn't use
thisand could be static. - PreferStraightApostropheRule
- Warns when stylized (curly) apostrophes are used instead of straight apostrophes.
- PreferStreamDistinctRule
- Warns when Stream is listened multiple times without .distinct().
- PreferStreamingForLargeFilesRule
- Warns when reading entire large files into memory instead of streaming.
- PreferStreamingResponseRule
- Warns when large file downloads don't use streaming.
- PreferStreamsOverPollingRule
- Suggests Streams over Timer.periodic for reactive data.
- PreferStreamTransformerRule
- Suggests Stream.transform() for reusable stream pipelines.
- PreferSuperKeyRule
-
Prefer
super.keyoverKey? keywithsuper(key: key)on Flutter widgets. - PreferSuperParametersRule
- Warns when Dart 3 super parameters could be used.
- PreferSwitchExpressionRule
- Prefer switch expression over switch statement when all cases are simple return/assignment (value mapping).
- PreferSwitchStatementRule
- Warns when a switch expression is used outside a value-producing position.
- PreferSwitchWithEnumsRule
- Warns when if-else chains on enum values could use a switch.
- PreferSwitchWithSealedClassesRule
- Warns when if-else chains on sealed class could use exhaustive switch.
- PreferSymbolOverKeyRule
- Warns when string keys are used in tests instead of Symbols.
- PreferSyncOverAsyncWhereSimpleRule
- Warns when Future.value() could be used instead of async for simple returns.
- PreferSystemThemeDefaultRule
- Warns when ThemeMode is hardcoded instead of using system default.
- PreferTabbarThemeIndicatorColorRule
-
Detects usage of the deprecated
ThemeData.indicatorColorproperty. - PreferTapRegionForDismissRule
- Warns when using GestureDetector for tap-outside-to-dismiss patterns.
- PreferTernaryOverCollectionIfRule
- Warns when ternary is preferred over collection-if (opposite rule).
- PreferTernaryOverIfNullRule
- Warns when ?? is used instead of explicit ternary (opposite rule).
- PreferTestDataBuilderRule
- Warns when tests create complex test objects without using builders.
- PreferTestFindByKeyRule
- Warns when find.byType is used instead of find.byKey in widget tests.
- PreferTestMatchersRule
- Warns when a switch statement could be converted to a switch expression.
- PreferTestNameDescriptiveRule
- Warns when descriptive test names are preferred over should/when (opposite).
- PreferTestNameShouldWhenRule
- Warns when test names don't follow "should X when Y" pattern.
- PreferTestReportRule
- PreferTestStructureRule
- Warns when test files don't follow proper structure.
- PreferTestVariantRule
- Warns when tests could use variant for different configurations.
- PreferTestWrapperRule
- Warns when widget tests don't wrap with MaterialApp/Scaffold.
- PreferTextInputActionRule
- Warns when TextField is missing textInputAction.
- PreferTextRichOverRichTextRule
- Warns when RichText is used instead of Text.rich().
- PreferTextRichRule
- Warns when a Sliver widget class doesn't have 'Sliver' prefix.
- PreferTextThemeRule
- Future rule: avoid-text-scale-factor
- PreferThemeExtensionsRule
- Warns when ThemeData uses ad-hoc color fields instead of ThemeExtension.
- PreferThenCatchErrorRule
- Warns when try/catch is used for async error handling instead of .then().catchError().
- PreferThenOverAwaitRule
- Warns when .then() is preferred over await (opposite rule).
- PreferTimeoutOnRequestsRule
- Warns when HTTP requests don't have a timeout specified.
- PreferTodoFormatRule
- Warns when TODO comments don't follow the standard format.
- PreferTrailingCommaAlwaysRule
- Warns when multi-line constructs don't have trailing commas.
- PreferTrailingCommaRule
- Warns when multi-line constructs are missing trailing commas.
- PreferTrailingUnderscoreForUnusedRule
- Warns when unused parameters don't have underscore prefix.
- PreferTransactionForBatchRule
- Warns when multiple database writes are not batched in transactions.
- PreferTransformOverContainerRule
- Warns when Container is used only for a transform.
- PreferTryParseForDynamicDataRule
- Warns when int/double/num/BigInt/Uri.parse is used without try-catch.
- PreferTweenSequenceRule
- Warns when multiple chained animations could use TweenSequence.
- PreferTypedDataRule
-
Warns when
List<int>is used for binary data instead of Uint8List. - PreferTypedefForCallbacksRule
- Future rule: prefer-typedef-for-callbacks
- PreferTypedefsForCallbacksRule
- Warns when more specific switch cases should come before general ones.
- PreferTypedPrefsWrapperRule
- Warns when SharedPreferences is used directly without a typed wrapper.
- PreferTypedRouteParamsRule
- Warns when route parameters are used as strings without type conversion.
- PreferTypeOverVarRule
-
Warns when
varis used instead of explicit type. - PreferTypeSyncOverIsLinkSyncRule
-
Flags static
FileSystemEntity.isLinkSync(path)calls and suggestsFileSystemEntity.typeSync(path, followLinks: false) == FileSystemEntityType.linkfor portable cross-platform behavior. - PreferUniqueTestNamesRule
- Warns when test names are duplicated within a test file.
- PreferUnmodifiableCollectionsRule
- Make collection fields unmodifiable to prevent mutation.
- PreferUnwrappingFutureOrRule
-
Warns when
FutureOr<T>could be unwrapped for cleaner handling. - PreferUrlLauncherFallbackRule
- Warns when URL launcher is used without a fallback for unsupported schemes.
- PreferUrlLauncherUriOverStringRule
- Warns when launchUrl is used with string parsing instead of Uri objects.
- PreferUrlStrategyForWebRule
- Warns when web apps don't use path URL strategy.
- PreferUseCallbackRule
- Warns when inline closures are used instead of useCallback in HookWidgets.
- PreferUsePrefixRule
- Warns when buildWhen callback is empty or always returns true.
- PreferUsingForTempResourcesRule
- Suggests using pattern (or try-finally) for temporary resources.
- PreferUsingListViewRule
- Warns when a Column is used inside SingleChildScrollView instead of ListView.
- PreferUtcDateTimesRule
- Future rule: prefer-utc-datetimes
- PreferUtcForStorageRule
- Warns when DateTime is stored or serialized without converting to UTC.
- PreferUtf8EncodeRule
-
Flags
Utf8Encoder().convert(x)andconst Utf8Encoder().convert(x)and suggestsutf8.encode(x)instead. - PreferUuidV4Rule
- Suggests using UUID v4 instead of v1 for better randomness.
- PreferValueListenableBuilderRule
- Warns when ValueListenableBuilder could simplify state management.
- PreferVarOverExplicitTypeRule
-
Warns when
varis used instead of explicit type annotations. - PreferVerbMethodNamesRule
- Prefer verb method names; flag noun-like method names.
- PreferVideoLoadingPlaceholderRule
- Warns when video player widgets lack a placeholder.
- PreferVisibilityOverOpacityZeroRule
-
Flags
Opacity(opacity: 0.0, ...)and suggestsVisibilityinstead. - PreferVisibleForTestingOnMembersRule
- Warns when @visibleForTesting should be used on members.
- PreferVoidCallbackRule
- Warns when void Function() is used instead of VoidCallback typedef.
- PreferWeakReferencesForCacheRule
- Warns when WeakReference should be used for cached references.
- PreferWeakReferencesRule
- PreferWebViewJavaScriptDisabledRule
- Warns when payment or sensitive operations lack biometric authentication.
- PreferWebviewSandboxRule
- Suggests sandboxing WebView (e.g. disable file access) when not needed.
- PreferWhenGuardOverIfRule
- Warns when a switch case uses a nested if statement that could be a when guard.
- PreferWhereOrNullRule
- Suggests using *OrNull methods instead of *Where with orElse callback.
- PreferWhereTypeOverWhereIsRule
-
Warns when
.where((e) => e is T)is used instead of.whereType<T>(). - PreferWhitelistValidationRule
- Suggests whitelist (allowlist) validation over blacklist for input.
- PreferWidgetMethodsOverClassesRule
- Warns when small widgets could be extracted as methods instead of classes.
- PreferWidgetPrivateMembersRule
- Warns when using Column inside SingleChildScrollView instead of ListView.
- PreferWidgetStateMixinRule
- Future rule: prefer-semantic-widget-names
- PreferWildcardForUnusedParamRule
-
Warns when a positional parameter is unused and could use wildcard
_. - PreferWildcardPatternRule
- Warns when a variable could use wildcard pattern (_) instead.
- PreferWrapOverOverflowRule
- Warns when Text widgets are not wrapped with DefaultTextStyle.
- PreferXdgDirectoryConventionRule
- Detects manual construction of XDG directory paths.
- PreferZoneErrorHandlerRule
- ProgressTrackerData
-
Immutable snapshot of
ProgressTrackerdata for report generation. - ProjectContext
- ProperGetxSuperCallsRule
-
Warns when GetxController overrides
onInitoronClosewithout calling super. - ProperSuperCallsRule
- Warns when super lifecycle methods are called in wrong order.
- ProvideCorrectIntlArgsRule
- Warns when Intl.message arguments don't match placeholders.
- RecordFieldsOrderingRule
- Warns when record fields are not in alphabetical order.
- ReportConfig
- Snapshot of the analysis configuration captured at rule-loading time.
- RequireAccessibilityTestsRule
- Warns when widget tests lack accessibility guidelines check.
- RequireAccessibleImagesRule
- Warns when Image widget lacks semanticLabel or excludeFromSemantics.
- RequireAddAutomaticKeepAlivesOffRule
- Warns when long lists have addAutomaticKeepAlives enabled (default).
- RequireAnalyticsErrorHandlingRule
- Warns when analytics calls lack error handling.
- RequireAnalyticsEventNamingRule
- Warns when analytics event names do not follow snake_case convention.
- RequireAndroid12SplashRule
- Warns when Flutter app may show double splash on Android 12+.
- RequireAndroidBackupRulesRule
- Warns when sensitive data storage is used without backup exclusion.
- RequireAndroidPermissionRequestRule
- Warns when Android permissions are declared but runtime request is missing.
- RequireAnimatedBuilderChildRule
- Warns when nested scrollables don't have NeverScrollableScrollPhysics.
- RequireAnimationControllerDisposeRule
- Warns when AnimationController is not disposed.
- RequireAnimationCurveRule
- Warns when animations don't specify a curve.
- RequireAnimationDisposalRule
- Warns when Border.all is used instead of const Border.fromBorderSide.
- RequireAnimationStatusListenerRule
- Warns when one-shot animation lacks StatusListener for cleanup.
- RequireAnimationTestsRule
- Warns when animated widget tests don't use pump with duration.
- RequireAnimationTickerDisposalRule
- Warns when Ticker is created without stop() in dispose.
- RequireApiErrorMappingRule
- Warns when API errors are not mapped to domain errors.
- RequireApiResponseValidationRule
- Suggests validating API response shape before use.
- RequireApiVersionHandlingRule
- Suggests handling API version in requests or config.
- RequireAppleSigninNonceRule
- Warns when Apple Sign-In is used without nonce parameter.
- RequireAppleSignInRule
- Quick fix that replaces http:// with https://. Warns when permission-requiring APIs are used without Info.plist entries.
- RequireAppLifecycleHandlingRule
- Warns when State subclasses use Timer or stream subscriptions without
- RequireAppStartupErrorHandlingRule
- Warns when main() or runApp() doesn't have error handling.
- RequireArrangeActAssertRule
- Warns when tests don't follow the Arrange-Act-Assert pattern.
- RequireAsyncErrorDocumentationRule
- Warns when async function doesn't handle errors internally.
- RequireAsyncValueOrderRule
- Warns when AsyncValue.when() has incorrect parameter order.
- RequireAudioFocusHandlingRule
- Warns when audio playback lacks AudioSession configuration.
- RequireAuthCheckRule
- Warns when SQL queries are built using string interpolation.
- RequireAutoDisposeRule
- Suggests using autoDispose modifier on Riverpod providers.
- RequireAutofillHintsRule
- Warns when TextField or TextFormField lacks autofillHints parameter.
- RequireAutoRouteDeepLinkConfigRule
- Suggests configuring deep links for auto_route routes.
- RequireAutoRouteFullHierarchyRule
-
Warns when
context.router.push()is used in an auto_route project. - RequireAutoRouteGuardResumeRule
-
Warns when an
AutoRouteGuardmay not callresolver.next()on all paths. - RequireAutoRoutePageSuffixRule
- Warns when an AutoRoute page class does not have a Page suffix.
- RequireAvatarAltTextRule
- Warns when CircleAvatar lacks a semanticLabel for accessibility.
- RequireAvatarFallbackRule
- Warns when CircleAvatar with NetworkImage lacks error handling.
- RequireAwaitInDriftTransactionRule
- Warns when queries inside a Drift transaction callback are not awaited.
- RequireBackgroundMessageHandlerRule
- Warns when FCM is used without a background message handler.
- RequireBackupExclusionRule
- Suggests excluding sensitive data from Android backup.
- RequireBadgeCountLimitRule
- Warns when Badge displays count greater than 99 without truncation.
- RequireBadgeSemanticsRule
- Warns when Badge widget lacks accessibility semantics.
- RequireBaselineTextBaselineRule
-
Warns when
SpacerorExpandedis used inside aWrapwidget. - RequireBiometricFallbackRule
- Warns when user input is used without sanitization.
- RequireBleDisconnectHandlingRule
- Warns when BLE device connection lacks disconnect state listener.
- RequireBlocCloseRule
- Requires Bloc/Cubit fields to be closed in dispose.
- RequireBlocConsumerWhenBothRule
- Suggests using BlocConsumer when both BlocListener and BlocBuilder are nested.
- RequireBlocErrorStateRule
- Warns when Bloc state sealed class doesn't have an error case.
- RequireBlocEventSealedRule
- Warns when Bloc events are not sealed classes.
- RequireBlocInitialStateRule
- Warns when Bloc constructor doesn't call super with initial state.
- RequireBlocLoadingStateRule
- Warns when Bloc async handler doesn't emit loading state.
- RequireBlocManualDisposeRule
- Warns when Bloc/Cubit has controllers or streams without close() cleanup.
- RequireBlocObserverRule
- Warns when BlocProvider is used without a BlocObserver setup.
- RequireBlocRepositoryAbstractionRule
- Warns when Bloc directly depends on repository implementations.
- RequireBlocRepositoryInjectionRule
- Warns when Bloc creates its own repository instead of receiving via constructor.
- RequireBlocSelectorRule
- Warns when BlocBuilder accesses only one field from state.
- RequireBlocTransformerRule
- Warns when Bloc event handlers don't use EventTransformer.
- RequireBluetoothStateCheckRule
- Warns when Bluetooth operations start without checking adapter state.
- RequireButtonLoadingStateRule
- Warns when buttons don't have a loading state for async operations.
- RequireButtonSemanticsRule
- Warns when custom tap targets lack Semantics with button: true.
- RequireCachedImageDevicePixelRatioRule
- Warns when CachedNetworkImage uses fixed width/height without DPR.
- RequireCachedImageDimensionsRule
- Warns when CachedNetworkImage is used without memory cache dimensions.
- RequireCachedImageErrorWidgetRule
- Warns when CachedNetworkImage is used without error widget.
- RequireCachedImagePlaceholderRule
- Warns when CachedNetworkImage is used without placeholder.
- RequireCacheEvictionPolicyRule
- Warns when caches lack eviction policies.
- RequireCacheExpirationRule
- Warns when cache implementations lack expiration logic.
- RequireCacheKeyDeterminismRule
-
Quick fix: Adds a
HACKcomment suggesting factory constructor conversion. Warns when cache keys use non-deterministic values. - RequireCacheKeyUniquenessRule
- Quick fix that adds a maxSize constant to the cache class. Warns when cache keys may not be unique.
- RequireCalendarTimezoneHandlingRule
- Warns when device_calendar Event doesn't specify time zone handling.
- RequireCameraDisposeRule
- Warns when CameraController is not disposed.
- RequireCameraPermissionCheckRule
- Warns when camera is accessed without permission check.
- RequireCancellableOperationsRule
- Suggests making long-running operations cancellable.
- RequireCancelTokenRule
- Warns when async requests lack cancellation support.
- RequireCatchLoggingRule
- Warns when catch blocks silently swallow exceptions without logging.
- RequireCertificatePinningRule
- Warns when certificate pinning is not implemented for HTTPS.
- RequireChangeNotifierDisposeRule
- Warns when an owned ChangeNotifier-derived field is not disposed.
- RequireClipboardPasteValidationRule
- Warns when clipboard paste is used without validation.
- RequireCompleterErrorHandlingRule
- Warns when Completer is created but never completed in error paths.
- RequireComplexLogicCommentsRule
- Warns when complex methods lack explanatory comments.
- RequireCompressionRule
- HTTP requests should request gzip compression when appropriate.
- RequireConfigValidationRule
- Suggests validating config values after load.
- RequireConflictResolutionStrategyRule
- Warns when sync methods may overwrite data without conflict resolution.
- RequireConnectivityCheckRule
- Warns when connectivity is not checked before network operations.
- RequireConnectivityErrorHandlingRule
- Warns when connectivity check is called without error handling.
- RequireConnectivityResumeCheckRule
- Suggests re-checking connectivity when app resumes (Android 8+).
- RequireConnectivitySubscriptionCancelRule
- Warns when connectivity subscription isn't canceled.
- RequireConnectivityTimeoutRule
- Warns when HTTP requests are made without a timeout.
- RequireConstListItemsRule
- Suggests const constructor calls in list literals when possible.
- RequireContentTypeCheckRule
- Warns when HTTP response is parsed without Content-Type check.
- RequireContentTypeValidationRule
- Suggests validating Content-Type before parsing response.
- RequireContextInBuildDescendantsRule
- Suggests passing context to descendants that need it in build().
- RequireCopyWithNullHandlingRule
- Warns when copyWith methods can't set nullable fields to null.
- RequireCorsHandlingRule
- Warns when HTTP calls on web lack CORS handling.
- RequireCovariantDocumentationRule
- Warns when covariant keyword is used without documentation.
- RequireCrashlyticsUserIdRule
- Warns when FirebaseCrashlytics is used without setting user identifier.
- RequireCurrencyCodeWithAmountRule
- Warns when money amounts are stored without currency information.
- RequireCurrencyFormattingLocaleRule
- Warns when NumberFormat.currency() lacks locale parameter.
- RequireCustomPainterShouldRepaintRule
- Warns when CustomPainter.shouldRepaint always returns true.
- RequireDarkModeTestingRule
- Warns when MaterialApp is created without a darkTheme parameter.
- RequireDatabaseCloseRule
- Warns when database connection is not properly closed.
- RequireDatabaseIndexRule
- Warns when frequently queried database fields lack indices.
- RequireDatabaseMigrationRule
- Warns when database schema changes lack migration support.
- RequireDataEncryptionRule
- Warns when common persistence APIs receive arguments that suggest sensitive data is being written without encryption.
- RequireDateFormatSpecificationRule
- Quick fix: Converts DateTime to .toIso8601String(). Warns when DateTime.parse is used with server dates without format spec.
- RequireDebouncerCancelRule
- Warns when a debouncer Timer is not canceled in dispose().
- RequireDeepEqualityCollectionsRule
- Collection fields in Equatable need DeepCollectionEquality.
- RequireDeepLinkFallbackRule
- Warns when deep link handler lacks fallback for invalid/missing content.
- RequireDeepLinkTestingRule
- Every route should be testable via deep link.
- RequireDeepLinkValidationRule
- Warns when API endpoints don't verify authentication.
- RequireDefaultConfigRule
- Warns when config access doesn't provide defaults for missing values.
- RequireDefaultTextStyleRule
- Warns when scrollable widgets don't specify scroll physics.
- RequireDeprecationMessageRule
- Warns when deprecated API lacks migration guidance.
- RequireDialogBarrierConsiderationRule
- Warns when destructive dialogs can be dismissed by tapping barrier.
- RequireDialogBarrierDismissibleRule
- Warns when showDialog is called without explicit barrierDismissible.
- RequireDialogResultHandlingRule
- Warns when showDialog result is not handled.
- RequireDialogTestsRule
- Warns when dialog tests don't handle special testing requirements.
- RequireDidUpdateWidgetCheckRule
- Warns when didUpdateWidget doesn't compare oldWidget.
- RequireDioErrorHandlingRule
- Warns when Dio requests are made without error handling.
- RequireDioInterceptorErrorHandlerRule
- Warns when Dio InterceptorsWrapper doesn't have onError handler.
- RequireDioResponseTypeRule
- Explicitly set responseType when processing binary data.
- RequireDioRetryInterceptorRule
- Network requests should have retry logic for resilience.
- RequireDioSingletonRule
- Warns when multiple Dio instances are created instead of using singleton.
- RequireDioSslPinningRule
- Warns when Dio is used for auth endpoints without SSL pinning.
- RequireDioTimeoutRule
- Warns when Dio is used without timeout configuration.
- RequireDirectionalWidgetsRule
- Warns when text direction is not considered.
- RequireDisabledStateRule
- Warns when Row/Column with overflow could use Wrap instead.
- RequireDiScopeAwarenessRule
- Understand singleton vs factory vs lazySingleton scopes in GetIt.
- RequireDisposeImplementationRule
- Warns when a StatefulWidget has disposable resources but no dispose() method.
- RequireDisposePatternRule
- Warns when dispose pattern is not followed for resource classes.
- RequireDisposeRule
- Warns when a widget that has its own padding property is wrapped in Padding.
- RequireDisposeVerificationTestsRule
- Suggests tests that verify dispose() is called on stateful/stream resources.
- RequireDragAlternativesRule
- Warns when drag gestures lack button alternatives.
- RequireDragFeedbackRule
- Warns when Draggable doesn't have feedback widget.
- RequireDriftCreateAllInOnCreateRule
-
Warns when a Drift
onCreatecallback does not callcreateAll(). - RequireDriftDatabaseCloseRule
- Warns when a Drift database field is not closed in dispose().
- RequireDriftEqualsValueRule
-
Warns when
.equals()is called with an enum argument on a Drift column. - RequireDriftForeignKeyPragmaRule
- Warns when a Drift database class lacks PRAGMA foreign_keys = ON.
- RequireDriftOnUpgradeHandlerRule
- Warns when a Drift database has schemaVersion > 1 but no onUpgrade.
- RequireDriftReadsFromRule
- Warns when customSelect().watch() is missing the readsFrom parameter.
- RequireDriftReadTableOrNullRule
-
Warns when
readTable()is used in a query that contains a left join. - RequireDriftSchemaVersionBumpRule
- Warns when schemaVersion is 1 in a database with many tables.
- RequireDriftStreamCancelRule
- Warns when a Drift .watch() stream subscription is not canceled.
- RequireEdgeCaseTestsRule
- Warns when tests don't cover edge cases.
- RequireEmptyResultsStateRule
- Warns when search results view has no empty state handling.
- RequireEnumUnknownValueRule
- Detects enum parsing from API without fallback for unknown values.
- RequireEnviedObfuscationRule
- Warns when Envied annotation lacks obfuscate parameter.
- RequireEquatableCopyWithRule
- Warns when Equatable class doesn't have a copyWith method.
- RequireEquatablePropsOverrideRule
- Warns when Equatable class doesn't override props.
- RequireErrorBoundaryRule
- Warns when error boundary widget is missing.
- RequireErrorCaseTestsRule
- Warns when test files don't include error case or boundary tests.
- RequireErrorContextInLogsRule
- Suggests including context (e.g. user id, request id) in error logs.
- RequireErrorContextRule
- Warns when error messages don't include context.
- RequireErrorHandlingGracefulRule
- Warns when raw exception message or toString() is shown in UI.
- RequireErrorHandlingInAsyncRule
- Warns when async provider lacks error handling.
- RequireErrorIdentificationRule
- Warns when error states don't have non-color indicators.
- RequireErrorLoggingRule
- Warns when caught errors are not logged.
- RequireErrorMessageClarityRule
- Suggests clear, user-facing error messages.
- RequireErrorMessageContextRule
- Warns when form validation error messages lack context.
- RequireErrorRecoveryRule
- Suggests providing recovery path when errors occur.
- RequireErrorStateRule
- Warns when BLoC state sealed class doesn't include an error state.
- RequireErrorWidgetRule
- Warns when findChildIndexCallback is called in build method.
- RequireExampleInDocumentationRule
- Warns when public class lacks example usage in documentation.
- RequireExceptionDocumentationRule
- Warns when exception documentation is missing.
- RequireExcludeSemanticsJustificationRule
- Warns when ExcludeSemantics is used without a comment explaining why.
- RequireExhaustiveSealedSwitchRule
- Warns when switch on sealed types uses default or wildcard, defeating exhaustiveness.
- RequireExifHandlingRule
- Warns when Image.file is used without EXIF orientation handling.
- RequireExpandoCleanupRule
-
Expando entries should be cleared (e.g.
expando[key] = null) when done. - RequireFcmTokenRefreshHandlerRule
- Warns when FCM is used without handling token refresh.
- RequireFeatureFlagDefaultRule
- Warns when feature flag is checked without a default/fallback value.
- RequireFeatureFlagTypeSafetyRule
- Warns when feature flags are accessed with raw string literal keys.
- RequireFileCloseInFinallyRule
- Warns when file handle is not closed in finally block.
- RequireFileExistsCheckRule
- Warns when file read operations are used without exists() check or try-catch.
- RequireFileHandleCloseRule
- Warns when RandomAccessFile is not closed.
- RequireFilePathSanitizationRule
- Warns when file paths are constructed from user input without sanitization.
- RequireFinallyCleanupRule
- Use finally for guaranteed cleanup, not just in catch.
- RequireFirebaseAppCheckProductionRule
- Warns when a Firebase project does not use Firebase App Check.
- RequireFirebaseAppCheckRule
- Warns when Firebase services are used without App Check.
- RequireFirebaseCompositeIndexRule
-
Warns when Firebase Realtime Database query uses
orderByChildwith filtering and likely needs a.indexOnrule in database security rules. - RequireFirebaseEmailEnumerationProtectionRule
- RequireFirebaseErrorHandlingRule
- Firebase calls can fail and should have error handling.
- RequireFirebaseInitBeforeUseRule
- Warns when Firebase services are used before initialization.
- RequireFirebaseOfflinePersistenceRule
- RequireFirebaseReauthenticationRule
- Warns when sensitive Firebase Auth operations are used without reauthentication.
- RequireFirebaseTokenRefreshRule
- Warns when getIdToken() result is stored without idTokenChanges refresh handling.
- RequireFirestoreIndexRule
- Warns when compound Firestore query may need a composite index.
- RequireFlutterRiverpodNotRiverpodRule
- Flutter apps need flutter_riverpod, not just riverpod.
- RequireFlutterRiverpodPackageRule
-
Warns when
riverpodis imported withoutflutter_riverpodin Flutter. - RequireFocusIndicatorRule
- Warns when interactive widget lacks visible focus styling.
- RequireFocusNodeDisposeRule
- Requires FocusNode fields to be disposed in State classes.
- RequireFocusOrderRule
- RequireFormAutoValidateModeRule
- Warns when Form widget doesn't have autovalidateMode parameter.
- RequireFormFieldControllerRule
- Warns when TextFormField has neither controller nor onSaved.
- RequireFormKeyInStatefulWidgetRule
-
Warns when
GlobalKey<FormState>is created inside build(). - RequireFormKeyRule
- Warns when Form widget doesn't have a GlobalKey.
- RequireFormRestorationRule
- Warns when long forms don't use state restoration.
- RequireFormValidationRule
- Warns when AppBar is used inside CustomScrollView instead of SliverAppBar.
- RequireFreezedArrowSyntaxRule
- Warns when Freezed fromJson has block body instead of arrow syntax.
- RequireFreezedExplicitJsonRule
- Warns when Freezed is used without explicit_to_json in build.yaml for nested objects.
- RequireFreezedJsonConverterRule
- Custom types in Freezed classes need JsonConverter.
- RequireFreezedLintPackageRule
- Install freezed_lint for official linting of Freezed classes.
- RequireFreezedPrivateConstructorRule
- Warns when Freezed class is missing the private constructor.
- RequireFutureOrDocumentationRule
- Warns when FutureOr is used in public API without documentation.
- RequireFutureTimeoutRule
- Warns when long-running Futures don't have a timeout.
- RequireFutureWaitErrorHandlingRule
- Warns when Future.wait is used without error handling for partial failures.
- RequireGeolocatorBatteryAwarenessRule
- Warns when continuous location tracking doesn't consider battery impact.
- RequireGeolocatorErrorHandlingRule
- Warns when Geolocator requests are made without error handling.
- RequireGeolocatorPermissionCheckRule
- Warns when Geolocator is used without permission check.
- RequireGeolocatorServiceEnabledRule
- Warns when Geolocator is used without checking if service is enabled.
- RequireGeolocatorStreamCancelRule
- Warns when getPositionStream subscription is not canceled.
- RequireGeolocatorTimeoutRule
- Warns when getCurrentPosition is called without timeLimit.
- RequireGetitDisposeRegistrationRule
- Suggests disposing GetIt registrations in tests or on app shutdown.
- RequireGetItRegistrationOrderRule
- Warns when GetIt registration order may cause unresolved dependencies.
- RequireGetItResetInTestsRule
- Warns when GetIt is used in tests without reset in setUp.
- RequireGetxBindingRoutesRule
- GetX routes should use Bindings for dependency injection.
- RequireGetxBindingRule
- Warns when GetxController is used without proper Binding registration.
- RequireGetxControllerDisposeRule
- Warns when GetX controller doesn't call dispose on resources.
- RequireGetxLazyPutRule
- Warns when Get.put is used for controllers that might not be needed immediately.
- RequireGetxPermanentCleanupRule
- Warns when Get.put(permanent: true) is used without manual cleanup.
- RequireGetxWorkerDisposeRule
- Warns when GetX Workers (ever, debounce, interval, once) are stored
- RequireGoldenTestRule
- Warns when visual widgets should have golden tests.
- RequireGoogleFontsFallbackRule
- Warns when GoogleFonts usage lacks fontFamilyFallback.
- RequireGoogleSigninErrorHandlingRule
- Warns when Google Sign-In calls lack try-catch error handling.
- RequireGoRouterErrorHandlerRule
- Warns when GoRouter is configured without error handler.
- RequireGoRouterFallbackRouteRule
- Router should have catch-all or error route for unknown paths.
- RequireGoRouterRefreshListenableRule
- Warns when GoRouter with auth doesn't have refreshListenable.
- RequireGoRouterTypedParamsRule
- Warns when go_router path parameters are used without type conversion.
- RequireGraphqlErrorHandlingRule
- Warns when GraphQL response is used without checking for errors.
- RequireGraphqlOperationNamesRule
- Warns when GraphQL query/mutation strings lack operation names.
- RequireHeadingHierarchyRule
- RequireHeadingSemanticsRule
- Warns when section headers don't have heading semantics.
- RequireHeroTagUniquenessRule
- Warns when duplicate Hero tags are found in the same file.
- RequireHiveAdapterRegistrationOrderRule
- Warns when Hive.openBox is called before registering all adapters.
- RequireHiveBoxCloseRule
- Warns when Hive box is opened but not closed in dispose.
- RequireHiveDatabaseCloseRule
- Warns when database is opened but no close() method found.
- RequireHiveEncryptionKeySecureRule
- Warns when HiveAesCipher uses a hardcoded encryption key.
- RequireHiveFieldDefaultValueRule
- Warns when @HiveField on nullable fields lacks defaultValue.
- RequireHiveInitializationRule
- Warns when Hive.openBox is called without verifying Hive.init was called.
- RequireHiveMigrationStrategyRule
- Warns when @HiveType class is modified without migration strategy.
- RequireHiveNestedObjectAdapterRule
- Warns when nested objects in @HiveType don't have their own adapters.
- RequireHiveTypeAdapterRule
- Warns when custom types are stored in Hive without @HiveType annotation.
- RequireHiveTypeIdManagementRule
- Warns when @HiveType typeIds may conflict or change.
- RequireHiveWebSubdirectoryRule
- Warns when Hive.initFlutter() is called without a subDir parameter on
- RequireHoverStatesRule
- Requires ScrollController fields to be disposed in State classes.
- RequireHttpClientCloseRule
- Warns when HttpClient is not closed.
- RequireHttpsForIosRule
- Warns when HTTP URLs are used that iOS App Transport Security will block.
- RequireHttpsOnlyRule
- Warns when HTTP (non-HTTPS) URLs are hardcoded in source code.
- RequireHttpsOnlyTestRule
- Detects HTTP URLs in test files at reduced severity.
- RequireHttpsOverHttpRule
- Warns when http:// URLs are used in network calls.
- RequireHttpStatusCheckRule
- Warns when HTTP response status is not checked.
- RequireIgnoreCommentSpacingRule
-
Warns when
// ignore:or// ignore_for_file:has no space after the colon. - RequireImageCacheDimensionsRule
- Warns when Image.network is used without a cacheWidth/cacheHeight.
- RequireImageCacheManagementRule
- Warns when image cache is not managed in apps with many images.
- RequireImageCompressionRule
- Warns when images from camera are uploaded without compression.
- RequireImageDescriptionRule
- Warns when Image widget lacks semanticLabel or excludeFromSemantics.
- RequireImageDimensionsRule
- Requires network images to specify width and height for layout stability.
- RequireImageDisposalRule
- Warns when image memory is not properly managed.
- RequireImageErrorBuilderRule
- Requires Image.network to have an errorBuilder for handling load failures.
- RequireImageErrorFallbackRule
- Warns when Image.network is used without an errorBuilder callback.
- RequireImageLoadingPlaceholderRule
- Warns when Image.network is used without a loadingBuilder callback.
- RequireImageMemoryCacheLimitRule
- RequireImagePickerErrorHandlingRule
- Warns when pickImage is called without null check or try-catch.
- RequireImagePickerPermissionAndroidRule
- Reminder to add camera permission for image_picker on Android.
- RequireImagePickerPermissionIosRule
- Reminder to add camera permission for image_picker on iOS.
- RequireImagePickerResultHandlingRule
- Warns when pickImage result is not checked for null.
- RequireImagePickerSourceChoiceRule
- Warns when ImageSource is hardcoded without giving user choice.
- RequireImageSemanticsRule
- Warns when Image widget lacks a semanticLabel for screen readers.
- RequireImageStreamDisposeRule
- Warns when ImageStream is used without removeListener cleanup.
- RequireImmutableBlocStateRule
- Warns when BLoC state classes are not immutable.
- RequireInitialStateRule
- Warns when BLoC constructor doesn't pass initial state to super.
- RequireInitStateIdempotentRule
- Warns when initState registers listeners without matching remove in dispose.
- RequireInputSanitizationRule
- Warns when SharedPreferences is used for sensitive data.
- RequireInputValidationRule
- Warns when raw controller text is sent in API calls without validation.
- RequireIntegrationTestSetupRule
- Warns when integration tests don't initialize the test binding.
- RequireIntegrationTestTimeoutRule
- Warns when integration tests don't have a timeout.
- RequireInterfaceForDependencyRule
- RequireIntervalTimerCancelRule
- Warns when Timer.periodic is not canceled in dispose().
- RequireIntlArgsMatchRule
- Warns when Intl.message args don't match placeholders in the message.
- RequireIntlCurrencyFormatRule
- Warns when currency/money values are formatted manually.
- RequireIntlDateFormatLocaleRule
- Warns when DateFormat is used without explicit locale parameter.
- RequireIntlLocaleInitializationRule
- Quick fix for PreferProvidingIntlExamplesRule.
- RequireIntlPluralRulesRule
- Warns when manual count-based string selection is used instead of Intl.plural.
- RequireIosAccessibilityLabelsRule
- Warns when NSUbiquitousKeyValueStore (iCloud Key-Value Storage) is used.
- RequireIosAccessibilityLargeTextRule
- Warns when iOS app may send misleading push notifications.
- RequireIosAgeRatingConsiderationRule
- Warns when iOS app may need age rating consideration.
- RequireIosAppClipSizeLimitRule
- Warns when StoreKit 2 APIs should be preferred over original StoreKit.
- RequireIosAppGroupCapabilityRule
- Warns when device model names are hardcoded instead of detected.
- RequireIosAppReviewPromptTimingRule
- Warns when app review is requested too early or too frequently.
- RequireIosAppTrackingTransparencyRule
- Warns when deprecated iOS 13+ APIs are used via platform channels.
- RequireIosAtsExceptionDocumentationRule
- Warns when bundle ID is hardcoded instead of from configuration.
- RequireIosBackgroundAudioCapabilityRule
- Warns when in-app purchases are used without receipt validation.
- RequireIosBackgroundModeRule
- Warns when apps use third-party login without Sign in with Apple.
- RequireIosBackgroundRefreshDeclarationRule
- Warns when background refresh may need capability declaration.
- RequireIosBiometricFallbackRule
- Warns when iOS 13+ Scene Delegate lifecycle may not be handled.
- RequireIosCallkitIntegrationRule
- Warns when CallKit integration may be missing for VoIP apps.
- RequireIosCarplaySetupRule
- Warns when CarPlay integration may need additional setup.
- RequireIosCertificatePinningRule
- Warns when NFC usage is detected without capability check.
- RequireIosDatabaseConflictResolutionRule
- Warns when Core Data or Realm sync is used without conflict resolution.
- RequireIosDataProtectionRule
- Suggests using iOS Data Protection for sensitive files.
- RequireIosDeploymentTargetConsistencyRule
- Warns when iOS deployment target may not match API usage.
- RequireIosDynamicIslandSafeZonesRule
- Warns when iOS Dynamic Island area may not be accounted for.
- RequireIosEntitlementsRule
- Warns when iOS entitlements may be needed for features.
- RequireIosFaceIdUsageDescriptionRule
- Warns when Face ID is used without NSFaceIDUsageDescription.
- RequireIosFocusModeAwarenessRule
- Warns when iOS Focus mode integration is not handled.
- RequireIosHealthKitAuthorizationRule
- Warns when HealthKit APIs are used without authorization check.
- RequireIosIcloudKvstoreLimitationsRule
- Warns when iOS Share Sheet is used without proper UTI declarations.
- RequireIosKeychainAccessibilityRule
- Warns when iOS-specific background task patterns exceed time limits.
- RequireIosKeychainForCredentialsRule
- Warns when iOS certificate pinning may be needed for security.
- RequireIosKeychainSyncAwarenessRule
- Warns when App Clip usage is detected without size considerations.
- RequireIosLaunchStoryboardRule
- Warns when iOS launch screen configuration may be missing.
- RequireIosLiveActivitiesSetupRule
- Warns when Live Activities may need proper configuration.
- RequireIosLocalNotificationPermissionRule
- Warns when HTTP connections are used without ATS exception documentation.
- RequireIosLowPowerModeHandlingRule
- Warns when app doesn't handle iOS Low Power Mode.
- RequireIosMethodChannelCleanupRule
- Warns when MethodChannel observer cleanup may be missing.
- RequireIosMinimumVersionCheckRule
- Warns when iOS version-specific APIs are used without version checks.
- RequireIosMultitaskingSupportRule
- Warns when iPad multitasking modes aren't handled.
- RequireIosNfcCapabilityCheckRule
- Warns when iOS app may not handle all device orientations.
- RequireIosOrientationHandlingRule
- Warns when critical accessibility features may be missing.
- RequireIosPasteboardPrivacyHandlingRule
- Warns when iOS pasteboard access may trigger iOS 16+ notification.
- RequireIosPermissionDescriptionRule
- RequireIosPhotoLibraryAddUsageRule
- Warns when saving photos without NSPhotoLibraryAddUsageDescription.
- RequireIosPhotoLibraryLimitedAccessRule
- Warns when Photo Library limited access may not be handled.
- RequireIosPrivacyManifestRule
- Warns when APIs requiring iOS 17+ Privacy Manifest are used.
- RequireIosPromotionDisplaySupportRule
- Warns when ProMotion display support may be needed.
- RequireIosPushNotificationCapabilityRule
- Warns when OAuth is performed via in-app WebView instead of system browser.
- RequireIosQuickNoteAwarenessRule
- Suggests using iOS context menus for touch-and-hold interactions.
- RequireIosReceiptValidationRule
- Warns when App Groups capability may be needed but not mentioned.
- RequireIosReviewPromptFrequencyRule
- Warns when in-app review may be requested too frequently.
- RequireIosSceneDelegateAwarenessRule
- Warns when deep linking may conflict with iOS Universal Links.
- Warns when iOS Keychain is accessed without considering iCloud sync.
- RequireIosSiriIntentDefinitionRule
- Warns when Siri Shortcuts are implemented without intent definition.
- RequireIosUniversalLinksDomainMatchingRule
- Warns when local notifications are scheduled without permission request.
- RequireIosVersionCheckRule
- Warns when iOS version-specific features lack platform checks.
- RequireIosVoiceoverGestureCompatibilityRule
- Warns when keyboard height is hardcoded instead of using ViewInsets.
- RequireIosWidgetExtensionCapabilityRule
- Warns when iOS Home Screen widgets are implemented without WidgetKit setup.
- RequireIsarCloseOnDisposeRule
- Warns when Isar.open/openSync is used without closing in dispose.
- RequireIsarCollectionAnnotationRule
- Warns when a class is used with Isar operations but lacks @collection.
- RequireIsarIdFieldRule
- Warns when @collection class is missing the required Id field.
- RequireIsarInspectorDebugOnlyRule
- Warns when Isar Inspector is used without kDebugMode guard.
- RequireIsarLinksLoadRule
- Warns when IsarLinks properties are accessed without calling load().
- RequireIsarNullableFieldRule
- Enforces nullable types for all Isar fields to prevent migration crashes.
- RequireIsolateForHeavyRule
- Warns when heavy computation is done on the main isolate.
- RequireIsolateKillRule
- Warns when Isolate is spawned without being killed.
- RequireItemExtentForLargeListsRule
- Warns when large lists don't specify itemExtent.
- RequireJsonDateFormatConsistencyRule
- RequireJsonDecodeTryCatchRule
- Warns when jsonDecode is used without try-catch.
- RequireJsonSchemaValidationRule
- Warns when JSON API responses are used without schema validation.
- RequireKeyboardActionTypeRule
- Warns when TextField or TextFormField lacks textInputAction parameter.
- RequireKeyboardDismissOnScrollRule
- Warns when scroll views lack keyboardDismissBehavior parameter.
- RequireKeyboardTypeRule
- Warns when email or phone fields use the wrong keyboard type.
- RequireKeyboardVisibilityDisposeRule
- Warns when KeyboardVisibilityController is not disposed.
- RequireKeychainAccessRule
- RequireKeyForCollectionRule
- Warns when widgets in lists lack a Key for efficient updates.
- RequireKeyForReorderableRule
- Warns when ReorderableListView items don't have keys.
- RequireKeysInAnimatedListsRule
- Warns when AnimatedList or AnimatedGrid items don't have keys.
- RequireLateAccessCheckRule
-
Warns when a
latenon-final field is accessed without an initialization check when it may be set outside the constructor or initState. - RequireLateInitializationInInitStateRule
- Warns when late widget fields are initialized in build() instead of initState().
- RequireLifecycleObserverRule
- Warns when Timer.periodic is used without WidgetsBindingObserver lifecycle handling.
- RequireLinkDistinctionRule
- RequireLinuxFontFallbackRule
- Detects TextStyle with platform-specific fonts without fallback fonts.
- RequireListPreallocateRule
- Warns when list is grown dynamically instead of preallocated.
- RequireLiveRegionRule
- Warns when dynamic content doesn't use live region semantics.
- RequireLocaleAwareFormattingRule
- Warns when locale-dependent formatting is not used.
- RequireLocaleForTextRule
- Warns when Stack children are not Positioned widgets.
- RequireLocationPermissionRationaleRule
- Warns when location permission is requested without showing rationale.
- RequireLocationTimeoutRule
-
Quick fix for PreferUtcForStorageRule that inserts
.toUtc()before the serialization method call. Warns when location request is made without a timeout. - RequireLogLevelForProductionRule
- Warns when verbose logging methods are used without a debug-mode guard.
- RequireLogoutCleanupRule
- Warns when logout doesn't clear all sensitive data.
- RequireLongPressCallbackRule
- Warns when GestureDetector widgets are nested, causing gesture conflicts.
- RequireMacosAppTransportSecurityRule
- Warns when macOS App Transport Security is needed.
- RequireMacosEntitlementsRule
- Warns when features requiring macOS entitlements are used.
- RequireMacosFileAccessIntentRule
- Warns when macOS file access may require user intent.
- RequireMacosHardenedRuntimeRule
- Warns when macOS app may not meet Hardened Runtime requirements.
- RequireMacosNotarizationReadyRule
- Reminds about notarization requirements for macOS distribution.
- RequireMacosSandboxEntitlementsRule
- Warns when macOS sandbox entitlements may be missing.
- RequireMacosSandboxExceptionsRule
- Warns when macOS sandbox entitlements may be needed.
- RequireMacosWindowRestorationRule
- Warns when macOS window restoration may not be implemented.
- RequireMacosWindowSizeConstraintsRule
- Warns when macOS apps lack window size constraints.
- RequireMapIdleCallbackRule
- Warns when map data is fetched on onCameraMove instead of onCameraIdle.
- RequireMediaLoadingStateRule
- Warns when VideoPlayer is used without checking isInitialized.
- RequireMediaPlayerDisposeRule
- Warns when VideoPlayerController or AudioPlayer is not disposed.
- RequireMenuBarForDesktopRule
- Warns when desktop app lacks menu bar.
- RequireMinimumContrastRule
- Warns when text may have insufficient contrast ratio.
- RequireMockHttpClientRule
- Warns when real HTTP clients are used in tests without mocking.
- RequireMockVerificationRule
- Warns when mocks are created but not verified.
- RequireMountedCheckAfterAwaitRule
- Warns when setState is called after await without mounted check.
- RequireMountedCheckRule
- Warns when setState is called with async gap.
- RequireMultiFactorRule
- RequireMultiProviderRule
- Warns when Provider package uses nested Provider widgets instead of
- RequireNativeResourceCleanupRule
- Warns when native resources are allocated without cleanup.
- Warns when Navigator.push() or Navigator.pushNamed() is called without
- RequireNetworkStatusCheckRule
- Check connectivity before making requests that will obviously fail.
- RequireNotificationActionHandlingRule
- Notification actions need handlers.
- RequireNotificationChannelAndroidRule
- Warns when Android notifications don't specify a channel ID.
- RequireNotificationForLongTasksRule
- Suggests showing notification for long-running tasks.
- RequireNotificationHandlerTopLevelRule
- Warns when background notification handler is an instance method.
- RequireNotificationInitializePerPlatformRule
- Warns when FlutterLocalNotificationsPlugin.initialize is called without
- RequireNotificationPermissionAndroid13Rule
- Warns when showing notifications without Android 13+ permission check.
- RequireNotificationTimezoneAwarenessRule
- Warns when scheduled notifications use DateTime instead of TZDateTime.
- RequireNotifyListenersRule
- Warns when ChangeNotifier subclass doesn't call notifyListeners.
- RequireNullSafeExtensionsRule
- Warns when extension method doesn't handle null receiver.
- RequireNullSafeJsonAccessRule
- Detects JSON map access without null safety handling.
- RequireNumberFormatLocaleRule
- Warns when NumberFormat is used without explicit locale parameter.
- RequireNumberFormattingLocaleRule
- Warns when NumberFormat lacks locale parameter.
- RequireOfflineIndicatorRule
- Warns when connectivity monitoring is used without an offline indicator.
- RequireOpenaiErrorHandlingRule
- Warns when OpenAI API calls (chat_gpt_sdk) lack try-catch error handling.
- RequireOrientationHandlingRule
- Warns when desktop apps lack keyboard shortcuts.
- RequireOverflowBoxRationaleRule
- Warns when Theme.of(context).brightness is used instead of colorScheme.
- RequirePageControllerDisposeRule
- Warns when PageController is not disposed.
- RequirePaginationErrorRecoveryRule
- Warns when a paginated list has no error recovery (retry/error state).
- RequirePaginationForLargeListsRule
- Warns when ListView.builder or GridView.builder uses a bulk-loaded list length as itemCount without pagination.
- RequirePaginationLoadingStateRule
- Warns when paginated list has no loading state for next page.
- RequireParameterDocumentationRule
- Warns when parameter documentation is missing for public methods.
- RequirePdfErrorHandlingRule
- Warns when PDF loading lacks error handling.
- RequirePdfLoadingIndicatorRule
- Warns when PDF viewer is used without a loading indicator.
- RequirePendingChangesIndicatorRule
- Users should see when local changes haven't synced.
- RequirePerformanceTestRule
- RequirePermissionDeniedHandlingRule
- Warns when permission denied state is not handled.
- RequirePermissionLifecycleObserverRule
- RequirePermissionManifestAndroidRule
- Reminder to add manifest entry for runtime permissions.
- RequirePermissionPermanentDenialHandlingRule
- Warns when permission denials aren't handled with settings redirect.
- RequirePermissionPlistIosRule
- Reminder to add Info.plist entries for iOS permissions.
- RequirePermissionRationaleRule
- Warns when requesting permissions without showing a rationale first.
- RequirePermissionStatusCheckRule
- Warns when using permission-gated features without checking status.
- RequirePhysicsForNestedScrollRule
- Warns when widget nesting exceeds 15 levels in a build method.
- RequirePlaceholderForNetworkRule
- Requires network images to have a placeholder or loadingBuilder.
- RequirePlatformChannelCleanupRule
- Warns when Platform Channel is used without cleanup.
- RequirePlatformCheckRule
- Warns when platform-specific APIs are used without Platform checks.
- RequirePluralHandlingRule
- Quick fix for RequireDirectionalWidgetsRule.
- RequirePopResultTypeRule
- MaterialPageRoute should specify result type when expecting a return value.
- RequirePriceLocalizationRule
- Warns when hardcoded prices are used instead of store-provided prices.
- RequireProviderDisposeRule
- Warns when ChangeNotifierProvider is used without dispose callback.
- RequireProviderGenericTypeRule
- Warns when Provider.of is used without a generic type parameter.
- RequireProviderScopeRule
- Warns when ProviderScope is missing from the app root.
- RequireProviderUpdateShouldNotifyRule
- RequirePublicApiDocumentationRule
- Warns when public API lacks documentation.
- RequirePumpAfterInteractionRule
- Warns when widget test doesn't pump the widget tree.
- RequirePurchaseRestorationRule
- Warns when "Restore Purchases" functionality is missing.
- RequirePurchaseVerificationRule
- Warns when in-app purchases lack server-side verification.
- RequireQrContentValidationRule
- Warns when QR scan result is used without URL or content validation.
- RequireQrPermissionCheckRule
- Warns when QR scanner is used without checking camera permission.
- RequireQrScanFeedbackRule
- Warns when QR scan success callback lacks haptic/visual feedback.
- RequireReceivePortCloseRule
- Warns when ReceivePort is not closed in dispose().
- RequireReducedMotionSupportRule
- RequireRefreshIndicatorOnListsRule
- Warns when ListView/GridView doesn't have RefreshIndicator.
- RequireRefreshIndicatorRule
- Warns when hardcoded TextStyle values are used instead of theme.
- RequireRepaintBoundaryRule
- Warns when complex animations don't use RepaintBoundary.
- RequireRequestTimeoutRule
- Warns when HTTP requests don't specify a timeout.
- RequireResponseCachingRule
- Warns when GET responses are not cached.
- RequireResponsiveBreakpointsRule
- Warns when MediaQuery width is compared to magic numbers.
- RequireResumeStateRefreshRule
- Warns when WidgetsBindingObserver doesn't handle resumed state.
- RequireRethrowPreserveStackRule
-
Warns when
throw eis used instead ofrethrow. - RequireRetryLogicRule
- Warns when retry logic is missing for network calls.
- RequireReturnDocumentationRule
- Warns when return value documentation is missing.
- RequireRiverpodAsyncValueGuardRule
- Warns when try-catch is used instead of AsyncValue.guard in Riverpod.
- RequireRiverpodErrorHandlingRule
- Warns when AsyncValue is used without error handling.
- RequireRiverpodLintRule
- Warns when a Riverpod project doesn't include riverpod_lint.
- RequireRouteGuardsRule
- Warns when protected routes lack authentication checks.
- RequireRouteTransitionConsistencyRule
- Warns when different page route transition types are mixed in the same app.
- RequireRtlLayoutSupportRule
- Warns when hardcoded left/right directional values are used in layouts.
- RequireRtlSupportRule
- RequireSafeAreaHandlingRule
- Warns when ColorScheme is created manually instead of using fromSeed.
- RequireSafeJsonParsingRule
- Warns when fromJson doesn't handle missing keys.
- RequireScreenSizeTestsRule
- Quick fix that wraps a widget with MaterialApp(home: ...). Warns when widget tests don't test multiple screen sizes.
- RequireScrollControllerDisposeRule
- Warns when Text widget is created with an empty string.
- RequireScrollControllerRule
- Warns when IntrinsicWidth/Height could improve layout.
- RequireScrollPhysicsRule
- Warns when hardcoded numeric values are used in layout widgets.
- RequireScrollTestsRule
- Warns when widget tests with scrollable content don't test scrolling.
- RequireSearchDebounceRule
- Warns when search TextField triggers API calls without debounce.
- RequireSearchLoadingIndicatorRule
- Warns when search triggers without loading indicator.
- RequireSecureKeyboardRule
- Warns when password field doesn't use obscureText.
- RequireSecureKeyGenerationRule
- Warns when encryption keys are generated from predictable byte patterns.
- RequireSecurePasswordFieldRule
- Warns when sensitive data is displayed without masking.
- RequireSecureStorageAuthDataRule
- Warns when JWT/auth tokens are stored in SharedPreferences.
- RequireSecureStorageErrorHandlingRule
- Warns when SSL/TLS certificate errors are ignored.
- RequireSecureStorageForAuthRule
- Warns when File/Directory paths include function parameters without
- RequireSecureStorageRule
- RequireSemanticColorsRule
- Warns when Color variables are named by their appearance (redColor,
- RequireSemanticLabelIconsRule
- Warns when Icon widget is used without a semanticLabel for accessibility.
- RequireSemanticsLabelRule
- Warns when Semantics widget is missing the label property.
- RequireSessionTimeoutRule
- Warns when authentication sign-in calls lack session timeout handling.
- Warns when string literals are used as SharedPreferences keys.
- Warns when SharedPreferences getter results are used without null handling.
- Warns when SharedPreferences.setPrefix is not called for app isolation.
- RequireShouldRebuildRule
- Warns when InheritedWidget is missing updateShouldNotify.
- RequireSnackbarActionForUndoRule
- Warns when SnackBar for delete operation doesn't have undo action.
- RequireSnackbarDurationRule
- Warns when SnackBar is created without explicit duration.
- RequireSocketCloseRule
- Warns when Socket is not closed in dispose().
- RequireSpeechStopOnDisposeRule
- Warns when SpeechToText is not stopped in dispose.
- RequireSqfliteCloseRule
- Warns when sqflite database is opened but not closed.
- RequireSqfliteErrorHandlingRule
- Warns when sqflite database operations are not wrapped in try-catch.
- RequireSqfliteIndexForQueriesRule
- RequireSqfliteMigrationRule
- Warns when SQLite onUpgrade doesn't check oldVersion properly.
- RequireSqfliteTransactionRule
- Warns when sqflite database operations are not in a transaction.
- RequireSqfliteWhereArgsRule
- Warns when SQL queries use string interpolation instead of whereArgs.
- RequireSseSubscriptionCancelRule
- Warns when EventSource/SSE connection is created without close() cleanup.
- RequireSslPinningSensitiveRule
- Warns when HTTP POST/PUT/PATCH to sensitive (auth) endpoints is made without certificate pinning.
- RequireStaggeredAnimationDelaysRule
- Warns when list item animations don't use staggered delays.
- RequireStatefulShellRouteTabsRule
- Tab navigation should use StatefulShellRoute to preserve state.
- RequireStepCountIndicatorRule
- Warns when multi-step flow lacks a progress indicator.
- RequireStepperStateManagementRule
- Warns when Stepper widget lacks proper form state management.
- RequireStepperValidationRule
- Warns when Stepper widget lacks validation in onStepContinue.
- RequireStreamCancelOnErrorRule
- RequireStreamControllerCloseRule
- Warns when StreamController is not closed in dispose().
- RequireStreamControllerDisposeRule
- Warns when StreamController is not disposed.
- RequireStreamErrorHandlingRule
- Warns when stream.listen() is called without onError handler.
- RequireStreamOnDoneRule
- Warns when Stream is listened to without onDone handler.
- RequireStreamSubscriptionCancelRule
- Warns when StreamSubscription is not canceled in dispose().
- RequireStructuredLoggingRule
- Warns when log calls use string concatenation instead of structured logging.
- RequireSubmitButtonStateRule
- Warns when submit buttons don't show loading state during submission.
- RequireSubscriptionCompositeRule
- RequireSubscriptionStatusCheckRule
- Warns when subscription features are accessed without status verification.
- RequireSupabaseErrorHandlingRule
- Warns when Supabase calls lack try-catch error handling.
- RequireSupabaseRealtimeUnsubscribeRule
- Warns when Supabase realtime subscriptions are not unsubscribed in dispose.
- RequireSuperDisposeCallRule
- Warns when app doesn't handle device orientation.
- RequireSuperInitStateCallRule
- Warns when initState() method doesn't call super.initState().
- RequireSvgErrorHandlerRule
- Warns when SvgPicture lacks errorBuilder callback.
- RequireSwitchControlRule
- RequireSyncErrorRecoveryRule
- Warns when sync error recovery is missing.
- RequireTabControllerDisposeRule
- Warns when TabController is not disposed.
- RequireTabControllerLengthSyncRule
- Warns when TabController length doesn't match TabBar children count.
- RequireTabStatePreservationRule
- Warns when TabBarView children don't preserve state on tab switch.
- RequireTestAssertionsRule
- Warns when test has no assertions.
- RequireTestCleanupRule
- Warns when test creates files/data without tearDown cleanup.
- RequireTestDescriptionConventionRule
- Warns when test descriptions don't follow conventions.
- RequireTestDocumentationRule
- Warns when complex tests lack documentation.
- RequireTestGroupsRule
- Warns when test file has many tests without group() organization.
- RequireTestIsolationRule
- Warns when tests share mutable state without proper isolation.
- RequireTestKeysRule
- Warns when widgets in tests don't have keys for findability.
- RequireTestSetupTeardownRule
- Warns when test file lacks setUp or tearDown.
- RequireTestWidgetPumpRule
- Warns when widget test interactions are not followed by pump.
- RequireTextEditingControllerDisposeRule
- Warns when TextEditingController is not disposed.
- RequireTextFormFieldInFormRule
- Warns when dispose() method doesn't call super.dispose().
- RequireTextInputTestsRule
- Warns when widget tests with text input don't test input behavior.
- RequireTextInputTypeRule
- Warns when TextField is missing keyboardType.
- RequireTextOverflowHandlingRule
- RequireTextOverflowInRowRule
- Warns when Text widget lacks overflow handling inside Row.
- RequireTextScaleFactorAwarenessRule
- Warns when fixed-height Container or SizedBox contains Text, risking overflow at large text scale.
- RequireThemeColorFromSchemeRule
-
Warns when ListView/GridView uses
shrinkWrap: trueinside a scrollable. - RequireTimerCancellationRule
- Requires Timer and StreamSubscription fields to be canceled in dispose().
- RequireTimezoneDisplayRule
- Warns when DateFormat is used without timezone patterns for display.
- RequireTokenRefreshRule
- Warns when token refresh logic is missing for auth tokens.
- RequireTypeAdapterRegistrationRule
- Warns when Hive type adapters are used without registration.
- RequireTypedApiResponseRule
- Warns when API response is not properly typed.
- RequireTypedDiRegistrationRule
- Warns when dependency registration lacks type safety.
- RequireUniqueIvPerEncryptionRule
- Warns when static or reused IVs are detected in encryption.
- RequireUnknownRouteHandlerRule
- Warns when MaterialApp/CupertinoApp lacks onUnknownRoute.
- RequireUpdateCallbackRule
- Warns when ProxyProvider doesn't properly handle the update callback.
- RequireUpdateShouldNotifyRule
- Warns when InheritedWidget is used without updateShouldNotify.
- RequireUrlLauncherCanLaunchCheckRule
- Warns when launchUrl is called without canLaunchUrl check.
- RequireUrlLauncherEncodingRule
- Warns when URL strings are not properly encoded before launching.
- RequireUrlLauncherErrorHandlingRule
- Warns when launchUrl is called without try-catch error handling.
- RequireUrlLauncherModeRule
- Warns when launchUrl() is called without specifying LaunchMode.
- RequireUrlLauncherQueriesAndroidRule
- Reminder to add queries element for url_launcher on Android 11+.
- RequireUrlLauncherSchemesIosRule
- Reminder to add LSApplicationQueriesSchemes for iOS url_launcher.
- RequireUrlValidationRule
- Warns when authentication tokens are stored in SharedPreferences instead
- RequireValidatorReturnNullRule
- Detects form validators that don't return null for valid input.
- RequireValueNotifierDisposeRule
- Warns when ValueNotifier is used without dispose.
- RequireVideoPlayerControllerDisposeRule
- Warns when VideoPlayerController field is not disposed.
- RequireVsyncMixinRule
- Warns when AnimationController is created without vsync.
- RequireWebRendererAwarenessRule
- Warns when kIsWeb is used without considering renderer type.
- RequireWebSocketCloseRule
- Warns when WebSocket is not closed on dispose.
- RequireWebSocketErrorHandlingRule
- Warns when WebSocket listeners don't have error handlers.
- RequireWebsocketMessageValidationRule
- Warns when WebSocket message is handled without validation.
- RequireWebsocketReconnectionRule
-
Quick fix: adds
.timeout(const Duration(seconds: 30))to HTTP requests. Quick fix: adds.timeout(const Duration(seconds: 60))for slower APIs. Warns when WebSocket connections lack reconnection logic. - RequireWebViewErrorHandlingRule
- Warns when WebView lacks error handling for resource loading failures.
- Warns when WebView is used without navigationDelegate.
- RequireWebViewProgressIndicatorRule
- Warns when WebView lacks a progress indicator for page loading.
- RequireWebviewSslErrorHandlingRule
- Warns when WebView lacks SSL error handling callback.
- RequireWebviewUserAgentRule
- RequireWidgetKeyStrategyRule
- Warns when widgets in lists don't have consistent key strategy.
- RequireWidgetsBindingCallbackRule
- Warns when Navigator.push/pushNamed is called inside build().
- RequireWillPopScopeRule
- RequireWindowCloseConfirmationRule
- Warns when desktop app lacks window close confirmation.
- RequireWindowSizeConstraintsRule
- Warns when Material widgets are used that have Cupertino equivalents.
- RequireWindowsSingleInstanceCheckRule
-
Quick fix that wraps both operands of a path comparison with
.toLowerCase()to make the comparison case-insensitive. Detects Windows desktop apps without single-instance enforcement. - RequireWorkmanagerConstraintsRule
- Warns when WorkManager task registration lacks constraints.
- RequireWorkmanagerForBackgroundRule
- Warns when workmanager is needed for reliable background tasks.
- RequireWorkmanagerResultReturnRule
- Warns when WorkManager callback does not return a result.
- RequireWssOverWsRule
- Warns when ws:// URLs are used for WebSocket connections.
- RequireYieldAfterDbWriteRule
-
Warns when a database or I/O write
awaitis not immediately followed by a yield to the UI thread. - ReturnInGeneratorRule
-
Generator (
async*/sync*) must not usereturnwith a value. - RuleDependencyGraph
- Tracks rule dependencies for fail-fast optimization.
- RuleExecutionStats
- Tracks rule execution statistics over time.
- RulePatternInfo
- Information about a rule's patterns for index building.
- RulePriorityInfo
- Information for building rule priority.
- RulePriorityQueue
- Manages rule execution order for optimal performance.
- RuleTimingRecord
- A record of timing data for a single rule.
- RuleTimingTracker
- Tracks cumulative timing for each rule across all files.
- SaropaLintRule
- Base class for Saropa lint rules with enhanced features:
- SecurePubspecUrlsRule
- Warns when pubspec.yaml contains insecure HTTP URLs.
- SmartContentFilter
- Quick content-based filtering to skip rules early.
- SortPubDependenciesRule
- Warns when pubspec dependencies are not sorted alphabetically.
- SubtypeOfDisallowedTypeRule
- Class, mixin, or enum must not extend / implement / mix in disallowed types.
- SuggestYieldAfterDbReadRule
-
Suggests inserting
yieldToUI()after a database or I/O bulk read. - TagNameRule
- Warns when widget tag names don't follow conventions.
- TypeCheckWithNullRule
-
Flags a type test with
Null(e.g.x is Null,x is! Null) as redundant; usex == nullorx != nullinstead. - UndefinedEnumConstructorRule
- Enum constructor invocation does not resolve (typo or missing constructor).
- UnintendedHtmlInDocCommentRule
- Warns when angle brackets in doc comments may be interpreted as HTML.
- UnnecessaryLibraryNameRule
-
A library directive that only has a name (e.g.
library my_lib;) with no URI is unnecessary for the analyzer and can be removed or replaced with a namelesslibrary;for documentation. - UnnecessaryTrailingCommaRule
- Warns when trailing commas are unnecessary.
- UriDoesNotExistInDocImportRule
-
Warns when a
@docImportURI refers to a non-existent file. - UriDoesNotExistRule
- Warns when an import, export, or part URI refers to a non-existent file.
- UseClosestBuildContextRule
- UseExistingDestructuringRule
- Warns when a class overrides == but not the parent's ==.
- UseExistingVariableRule
- Warns when a new variable is created that duplicates an existing one.
- UseRefAndStateSynchronouslyRule
-
Warns when
refis used after an await in an async method. - UseRefReadSynchronouslyRule
-
Warns when
ref.read()is called after anawaitin an async method. - UseSetStateSynchronouslyRule
- Warns when setState is called after an async gap without mounted check.
- UseSpecificDeprecationRule
- UseTruncatingDivisionRule
-
Prefer truncating division (
~/) over/followed by.toInt(). - VerifyDocumentedParametersExistRule
-
Warns when a dartdoc
[name]reference does not match any parameter, type, or field in scope. - ViolationBatch
- Batches violations for more efficient reporting.
- ViolationRecord
- A recorded lint violation with location and metadata.
- WrongNumberOfParametersForSetterRule
- A setter must declare exactly one required positional parameter (no optional positional, no named parameters).
- YieldInNonGeneratorRule
-
yield/yield*only allowed inasync*/sync*functions.
Enums
- AstNodeCategory
- Types of AST nodes that rules commonly care about.
- FileType
- Classification of a Dart file for rule filtering.
- LintImpact
- Impact classification for lint rules.
- OwaspMobile
- OWASP Mobile Application Security Top 10 (2024).
- OwaspWeb
- OWASP Top 10 Web Application Security Risks (2021).
- RuleCost
- Estimated cost of running a rule.
- RuleStatus
- Lifecycle status of a rule.
- RuleTier
- The tier at which a rule is enabled by default.
- RuleType
- Semantic type of a lint rule for policies, reporting, and quality gates.
- TestRelevance
- Controls how a lint rule interacts with test files.
Constants
-
allPackages
→ const List<
String> - All supported package names.
-
allPlatforms
→ const List<
String> - All supported platform names.
-
androidPlatformRules
→ const Set<
String> - Rules specific to the Android platform.
-
blocPackageRules
→ const Set<
String> - Rules specific to the Bloc/Cubit state management package.
-
comprehensiveOnlyRules
→ const Set<
String> - Rules that are only included in the comprehensive tier (not in professional). Comprehensive tier rules - stricter patterns, optimization hints, edge cases. Helpful but not critical. For quality-obsessed teams.
-
defaultPackages
→ const Map<
String, bool> - Default package settings.
-
defaultPlatforms
→ const Map<
String, bool> - Default platform settings.
-
dioPackageRules
→ const Set<
String> - Rules specific to the Dio HTTP client package.
-
driftPackageRules
→ const Set<
String> - Rules specific to the Drift database package.
-
equatablePackageRules
→ const Set<
String> - Rules specific to the Equatable package.
-
essentialRules
→ const Set<
String> - Essential tier rules - Critical rules that prevent crashes, data loss, and security holes. A single violation causes real harm: app crashes, data exposed, resources never released.
-
firebasePackageRules
→ const Set<
String> - Rules specific to the Firebase platform.
-
flamePackageRules
→ const Set<
String> - Rules specific to the Flame game engine package.
-
flutterHooksPackageRules
→ const Set<
String> - Rules specific to the flutter_hooks package.
-
flutterStylisticRules
→ const Set<
String> - Stylistic rules that only apply to Flutter projects (widget-related).
-
freezedPackageRules
→ const Set<
String> - Rules specific to the Freezed code generation package.
-
geolocatorPackageRules
→ const Set<
String> - Rules specific to the geolocator package.
-
getItPackageRules
→ const Set<
String> - Rules specific to the get_it dependency injection package.
-
getxPackageRules
→ const Set<
String> - Rules specific to the GetX state management package.
-
graphqlPackageRules
→ const Set<
String> - Rules specific to the GraphQL package.
-
hivePackageRules
→ const Set<
String> - Rules specific to the Hive database package.
-
iosPlatformRules
→ const Set<
String> - Rules specific to the iOS platform.
-
isarPackageRules
→ const Set<
String> - Rules specific to the Isar database package.
-
linuxPlatformRules
→ const Set<
String> - Rules specific to the Linux platform.
-
macosPlatformRules
→ const Set<
String> - Rules specific to the macOS platform.
-
pedanticOnlyRules
→ const Set<
String> - Pedantic tier rules - pedantic, highly opinionated rules. Rules most teams would find excessive. For greenfield projects.
-
professionalOnlyRules
→ const Set<
String> - Professional tier rules - Recommended + architecture, testing, maintainability. Includes stricter naming conventions for API parameters.
-
providerPackageRules
→ const Set<
String> - Rules specific to the Provider state management package.
-
qrScannerPackageRules
→ const Set<
String> - Rules specific to the QR scanner packages.
-
recommendedOnlyRules
→ const Set<
String> - Recommended tier rules - Essential + common mistakes, performance basics. Catches bugs that don't immediately crash but cause poor UX, sluggish performance.
-
riverpodPackageRules
→ const Set<
String> - Rules specific to the Riverpod state management package.
- Rules specific to the shared_preferences package.
-
sqflitePackageRules
→ const Set<
String> - Rules specific to the sqflite package.
-
stylisticRules
→ const Set<
String> - Stylistic tier rules - formatting, ordering, naming conventions. Orthogonal to correctness - code can be correct while violating these.
-
supabasePackageRules
→ const Set<
String> - Rules specific to the Supabase package.
-
urlLauncherPackageRules
→ const Set<
String> - Rules specific to the url_launcher package.
-
webPlatformRules
→ const Set<
String> - Rules specific to the Web platform.
-
windowsPlatformRules
→ const Set<
String> - Rules specific to the Windows platform.
-
workmanagerPackageRules
→ const Set<
String> - Rules specific to the workmanager package.
Properties
-
allSaropaRules
→ List<
SaropaLintRule> -
All available Saropa lint rules.
no setter
-
packageRuleSets
→ Map<
String, Set< String> > -
All package sets keyed by package name.
no setter
-
platformRuleSets
→ Map<
String, Set< String> > -
All platform sets keyed by platform name.
no setter
-
rulesWithFixes
→ Set<
String> -
Rule names that have at least one quick-fix generator.
no setter
- saropaLintsVersion → String
-
Reads the saropa_lints version from pubspec.yaml via the consumer
project's
.dart_tool/package_config.json. Falls back to'unknown'.no setter
Functions
-
getAllDefinedRules(
) → Set< String> - Returns the complete set of all rule names defined across all tiers.
-
getReturnTypeFromBody(
FunctionBody body) → DartType? -
Resolves the declared return type from a
FunctionBody's parent. -
getRulesDisabledByPackages(
Map< String, bool> packages) → Set<String> - Returns the set of rules that should be disabled based on disabled packages.
-
getRulesDisabledByPlatforms(
Map< String, bool> platforms) → Set<String> - Returns the set of rules that should be disabled based on disabled platforms.
-
getRulesForTier(
String tier) → Set< String> - Returns the set of rule names for a given tier. Tier names: 'essential' | 'recommended' | 'professional' | 'comprehensive' | 'pedantic' | 'stylistic'. Unknown tier falls back to essential. Used by init script and plugin config.
-
getRulesFromRegistry(
Set< String> ruleNames) → List<SaropaLintRule> - Get rules for a set of rule names.
-
initializeCacheManagement(
{int maxFileContentCache = 500, int maxMetricsCache = 2000, int maxLocationCache = 2000, int maxSymbolCache = 1000, int maxCompilationUnitCache = 1000, int memoryThresholdMb = 512}) → void - Initialize all caches with memory pressure handling.
-
isEquatable(
ClassDeclaration node) → bool - Checks if a class declaration extends Equatable or uses EquatableMixin.
-
loadNativePluginConfig(
) → void -
Loads all plugin configuration from yaml and environment variables.
Order matters: severity overrides first, then diagnostics (enable/disable),
then rule packs (adds enabled rule codes; skips
disabledRules), then baseline, banned usage, and output (max_issues, file-only). Safe to call multiple times — static fields are simply overwritten. Never throws; failures in any step are caught and the rest still run. -
loadNativePluginConfigFromProjectRoot(
String projectRoot) → void -
Reloads all plugin configuration using a known
projectRootinstead of Directory.current. Call when the analyzer supplies a file path from which the real project root can be derived (walk up topubspec.yaml). -
loadOutputConfigFromProjectRoot(
String projectRoot) → void -
Load max_issues and output from analysis_options_custom.yaml in
projectRoot. Call this when the project root is first known (e.g. from first analyzed file), so config is found even when the plugin runs with cwd in a temp directory. Safe to call multiple times; env vars still take precedence over file. -
loadRulePacksConfigFromProjectRoot(
String projectRoot) → void -
Re-merges rule packs using
projectRootfor config and lockfile (Phase 3). -
registerSaropaLintRules(
PluginRegistry registry) → void -
Registers Saropa lint rules and their quick-fix generators on
registry.