2.0.0
[2.0.0] - 2025-12-19
Major Release - Framework-Specific Lints
馃帀 Major expansion with 42 new lint rules across three new categories: Bloc, Provider, and FakeAsync, plus 11 new common lint rules!
New Categories
Bloc Lints (22 rules)
Framework-specific lints for the Bloc state management library:
avoid-bloc-public-fields- Warns when a Bloc or Cubit has public fieldsavoid-bloc-public-methods- Warns when a Bloc has public methods except overridden onesavoid-cubits- Warns when a Cubit is usedavoid-duplicate-bloc-event-handlers- Detects multiple handlers for the same eventavoid-empty-build-when- Requires buildWhen condition in BlocBuilder/BlocConsumeravoid-existing-instances-in-bloc-provider- Prevents reusing instances in BlocProvideravoid-instantiating-in-bloc-value-provider- Prevents new instances in BlocProvider.valueavoid-passing-bloc-to-bloc- Prevents Bloc dependencies on other Blocsavoid-passing-build-context-to-blocs- Prevents BuildContext in Bloc events/methodsavoid-returning-value-from-cubit-methods- Ensures Cubits communicate via statecheck-is-not-closed-after-async-gap- Requires isClosed checks in async handlersemit-new-bloc-state-instances- Prevents emitting existing state instanceshandle-bloc-event-subclasses- Ensures all event subclasses are handledprefer-bloc-event-suffix- Enforces "Event" suffix for event classesprefer-bloc-extensions- Suggests context.read()/watch() over BlocProvider.of()prefer-bloc-state-suffix- Enforces "State" suffix for state classesprefer-correct-bloc-provider- Ensures BlocProvider is used for Blocsprefer-immutable-bloc-events- Requires @immutable on Bloc eventsprefer-immutable-bloc-state- Requires @immutable on Bloc stateprefer-multi-bloc-provider- Suggests MultiBlocProvider for nested providersprefer-sealed-bloc-events- Requires sealed/final modifiers on event classesprefer-sealed-bloc-state- Requires sealed/final modifiers on state classes
Provider Lints (8 rules)
Framework-specific lints for the Provider state management library:
avoid-instantiating-in-value-provider- Prevents new instances in Provider.valueavoid-read-inside-build- Warns about read() usage in build methodsavoid-watch-outside-build- Warns about watch()/select() outside builddispose-providers- Ensures proper disposal of provided resourcesprefer-immutable-selector-value- Requires immutable values in Selectorprefer-multi-provider- Suggests MultiProvider for nested providersprefer-nullable-provider-types- Recommends nullable provider typesprefer-provider-extensions- Suggests context extensions over Provider.of()
FakeAsync Lints (1 rule)
Testing-focused lints for the fake_async package:
avoid-async-callback-in-fake-async- Prevents async callbacks in FakeAsync
New Common Lints (11 rules)
Enhanced common lints with new best practice rules:
prefer-async-await- Suggests async/await over Future APIprefer-contains- Suggests contains() over indexOf() != -1prefer-correct-for-loop-increment- Validates for-loop increment expressionsprefer-correct-json-casts- Ensures proper JSON type castingprefer-early-return- Recommends early returns to reduce nestingprefer-first- Suggests first over [0] or elementAt(0)prefer-iterable-of- Suggests Iterable.of() over manual iterationprefer-last- Suggests last over [length - 1]prefer-named-boolean-parameters- Requires named parameters for booleansprefer-return-await- Suggests explicit return await in try blocksprefer-switch-expression- Recommends switch expressions over statements
Documentation
- Added BLOC_LINTS.md with comprehensive Bloc lint documentation
- Added PROVIDER_LINTS.md with comprehensive Provider lint documentation
- Added FAKE_ASYNC_LINTS.md with FakeAsync lint documentation
- Updated test fixtures and configuration for new rules
Summary
Version 2.0.0 introduces:
- 42 new lint rules (22 Bloc + 8 Provider + 1 FakeAsync + 11 Common)
- 3 new framework-specific categories (Bloc, Provider, FakeAsync)
- Total of 128 lint rules across all categories
- Enhanced coverage for popular Flutter state management solutions
- Improved testing practices with FakeAsync support