Files
astromic_extensions/analysis_options.yaml
2026-01-08 14:39:34 +02:00

48 lines
2.5 KiB
YAML

include: package:flutter_lints/flutter.yaml
analyzer:
language:
# Ensures the compiler never implicitly assumes 'dynamic' when it cannot infer a type.
strict-inference: true
# Disallows the use of generic types without explicit type arguments (e.g., List instead of List<int>).
strict-raw-types: true
errors:
# Elevates missing required parameters from a warning to a hard compile error.
missing_required_param: error
# Elevates missing return statements in non-void functions to a hard compile error.
missing_return: error
linter:
rules:
# Requires explicit return types for all functions and methods to ensure API clarity.
- always_declare_return_types
# Discourages redundant type annotations on closure parameters where inference is sufficient.
- avoid_types_on_closure_parameters
# Requires the @override annotation when a class member overrides a member from a superclass.
- annotate_overrides
# Enforces the use of relative imports for files within the same package to maintain portability.
- prefer_relative_imports
# Enables the use of the 'super.parameter' syntax in constructors to reduce boilerplate.
- use_super_parameters
# Encourages 'const' constructors for classes to optimize memory and performance.
- prefer_const_constructors
# Requires 'const' for variable declarations that are initialized with a constant value.
- prefer_const_declarations
# Encourages declaring local variables as 'final' if they are not reassigned.
- prefer_final_locals
# Encourages declaring private fields as 'final' if they are not reassigned.
- prefer_final_fields
# Triggers a warning when a future is not awaited or explicitly handled, preventing race conditions.
- unawaited_futures
# Prevents accessing BuildContext across asynchronous gaps to avoid runtime crashes.
- use_build_context_synchronously
# Ensures that Sink and StreamController instances are properly closed to prevent memory leaks.
- close_sinks
# Prevents the use of control flow statements (like return or throw) inside a finally block.
- control_flow_in_finally
# Standardizes string literals to use single quotes unless the string contains a single quote.
- prefer_single_quotes
# Requires constructors to be placed before other members in a class.
- sort_constructors_first
# Disallows leading underscores for local variables to distinguish them from private class members.
- no_leading_underscores_for_local_identifiers