Skip to content

fix: resolve analyzer errors and bump to 2.0.0 - #157

Closed
Matkurban wants to merge 1 commit into
fluttercandies:mainfrom
Matkurban:main
Closed

Matkurban wants to merge 1 commit into
fluttercandies:mainfrom
Matkurban:main

Conversation

@Matkurban

Copy link
Copy Markdown

Summary

This PR fixes all analyzer errors/warnings, modernizes the codebase for current Flutter/Dart, and bumps the package to 2.0.0.

Breaking change — the minimum required versions are raised to Dart ^3.13.0 and Flutter >=3.47.0, and the package now depends on package:material_ui instead of package:flutter/material.dart.

Changes

Bug fixes

  • ObserverController: fix local variable shadowing errors (var controller = controller;) in _scrollToIndex, _handleScrollToIndexForFixedHeight and _handleScrollToIndex that prevented compilation under flutter_lints 6 (no_leading_underscores_for_local_identifiers).
  • ObserverWidget: fix the same shadowing error for scopeContext in _checkTagChange.
  • ChatScrollObserver: fix self-assignment of innerRefItemIndex, innerRefItemIndexAfterUpdate and innerRefItemLayoutOffset in standby.
  • Guard BuildContext usage across async gaps with mounted checks (use_build_context_synchronously).

Tooling / lint

  • Upgrade flutter_lints to ^6.0.0 in both the package and the example, and resolve every reported lint (super parameters, base class modifiers, null-aware elements, sort_child_properties_last, etc.).
  • Format all Dart sources with the Dart 3.13 formatter so dart format --set-exit-if-changed passes in CI.
  • Pin the example's any constraints to concrete versions.
  • Replace the example's outdated counter smoke test with a home page smoke test.

Release

  • Bump version to 2.0.0 and add the CHANGELOG entry.

Verification

Check Result
flutter analyze (package) No issues found
flutter analyze (example) No issues found
dart format . -o none --set-exit-if-changed 0 changed
flutter test (package) 83 tests passed
flutter test (example) 1 test passed
flutter pub publish --dry-run OK

Environment: Flutter 3.47.3 (stable) / Dart 3.13.3.

Notes for reviewers

  • The deprecated APIs annotated with @Deprecated('It will be removed in version 2 ...') are intentionally kept in this PR to keep the change reviewable; they can be removed in a follow-up.
  • Most of the 143 changed files are the mechanical material.dart → material_ui.dart import swap and formatter output; the behavioral fixes are concentrated in observer_controller.dart, observer_widget.dart and chat_scroll_observer.dart.

- Fix local variable shadowing errors (controller / scopeContext) that broke compilation
- Fix self-assignment of innerRefItem* fields in ChatScrollObserver.standby
- Guard BuildContext usage across async gaps with mounted checks
- Migrate to package:material_ui; require Dart ^3.13.0 / Flutter >=3.47.0
- Upgrade flutter_lints to ^6.0.0 in package and example, resolve all lints
- Format all Dart sources with the Dart 3.13 formatter
- Replace the outdated counter smoke test in example with a home page smoke test
- Bump version to 2.0.0 and update CHANGELOG
@LinXunFeng

Copy link
Copy Markdown
Member

Thanks a lot for the effort! Since scrollview_observer doesn't use any Material widgets, #156 can be solved by simply importing package:flutter/widgets.dart instead of material.dart. That way we don't need a material_ui dependency or to raise the minimum SDK to Flutter 3.47, and it can ship as a patch release. So I'm going to close this PR in favor of that smaller change.

@LinXunFeng LinXunFeng closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants