Skip to content

Conversation

@rrousselGit
Copy link
Owner

@rrousselGit rrousselGit commented Jun 2, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a new hook for managing expansible controllers.
  • Deprecation

    • The previous expansion tile controller hook is now deprecated in favor of the new expansible controller hook.
  • Documentation

    • Updated README and changelog to reflect the new expansible controller hook and its usage.
    • Improved clarity and consistency in hook documentation.
  • Tests

    • Updated tests to use the new expansible controller hook and improved test clarity.
  • Chores

    • Updated Flutter SDK version requirement to 3.32.0 or higher.
    • Renamed generic type parameters in reducer-related APIs for consistency.

@coderabbitai
Copy link

coderabbitai bot commented Jun 2, 2025

Walkthrough

The changes introduce a new useExpansibleController hook and deprecate useExpansionTileController, updating related documentation and tests accordingly. Generic type parameters in reducer-related APIs are renamed for clarity. The minimum Flutter SDK version is raised, and minor test and documentation adjustments are made to improve clarity and maintain consistency.

Changes

File(s) Change Summary
README.md, packages/flutter_hooks/CHANGELOG.md Updated documentation for hook renaming and deprecation; changelog entry for new hook and deprecation note.
packages/flutter_hooks/lib/src/expansion_tile_controller.dart Added useExpansibleController; deprecated useExpansionTileController; renamed internal classes/types.
packages/flutter_hooks/lib/src/hooks.dart Suppressed deprecation warning for ExpansionTileController import.
packages/flutter_hooks/lib/src/misc.dart Renamed generic type parameters from State/Action to StateT/ActionT in reducer-related APIs.
packages/flutter_hooks/pubspec.yaml Raised minimum Flutter SDK version requirement to 3.32.0.
packages/flutter_hooks/test/use_expansible_controller_test.dart Updated tests to use useExpansibleController and ExpansibleController naming.
packages/flutter_hooks/test/use_animation_controller_test.dart, ...use_ticker_provider_test.dart Added dart:async import; replaced direct .forward() calls with unawaited(...) for async clarity.
packages/flutter_hooks/test/use_transformation_controller_test.dart Broadened diagnostics assertion to accept multiple matrix string formats.

Sequence Diagram(s)

sequenceDiagram
  participant Widget as Widget
  participant Hook as useExpansibleController
  participant Controller as ExpansibleController

  Widget->>Hook: call useExpansibleController()
  Hook->>Controller: create ExpansibleController instance
  Controller-->>Hook: return instance
  Hook-->>Widget: return ExpansibleController
  Widget->>Controller: interact (expand/collapse)
Loading

Poem

In the warren, code hops anew,
Expansible by name, not just by view!
Old tiles retire, new hooks appear,
Generics renamed, the intent is clear.
Async calls marked, docs refined—
A garden of code, well-aligned!
🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
packages/flutter_hooks/lib/src/misc.dart (1)

20-20: ⚠️ Potential issue

Fix inconsistent generic parameter naming in the Reducer typedef.

The Reducer typedef still uses the old generic parameter names (State and Action) while the rest of the file has been updated to use StateT and ActionT for consistency.

Apply this diff to maintain consistency:

-typedef Reducer<State, Action> = State Function(State state, Action action);
+typedef Reducer<StateT, ActionT> = StateT Function(StateT state, ActionT action);
🧹 Nitpick comments (1)
packages/flutter_hooks/test/use_animation_controller_test.dart (1)

34-34: Good practice using unawaited(), but consider consistency.

Using unawaited(controller.forward()) is good practice to explicitly mark the future as intentionally unawaited. However, note that line 105 uses // ignore: unawaited_futures for the same purpose, creating inconsistency in the file.

Consider standardizing the approach throughout the file:

-    // ignore: unawaited_futures
-    controller.forward();
+    unawaited(controller.forward());
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8215f0 and 303ae67.

📒 Files selected for processing (10)
  • README.md (1 hunks)
  • packages/flutter_hooks/CHANGELOG.md (1 hunks)
  • packages/flutter_hooks/lib/src/expansion_tile_controller.dart (1 hunks)
  • packages/flutter_hooks/lib/src/hooks.dart (1 hunks)
  • packages/flutter_hooks/lib/src/misc.dart (5 hunks)
  • packages/flutter_hooks/pubspec.yaml (1 hunks)
  • packages/flutter_hooks/test/use_animation_controller_test.dart (2 hunks)
  • packages/flutter_hooks/test/use_expansible_controller_test.dart (3 hunks)
  • packages/flutter_hooks/test/use_ticker_provider_test.dart (2 hunks)
  • packages/flutter_hooks/test/use_transformation_controller_test.dart (1 hunks)
🔇 Additional comments (15)
packages/flutter_hooks/lib/src/hooks.dart (1)

9-10: Appropriate lint suppression for backward compatibility.

The // ignore: deprecated_member_use comment correctly suppresses deprecation warnings for ExpansionTileController while maintaining backward compatibility during the transition to useExpansibleController.

packages/flutter_hooks/CHANGELOG.md (1)

1-4: Clear deprecation documentation.

The changelog entry properly documents the deprecation of useExpansionTileController in favor of useExpansibleController, providing clear guidance for users during the migration.

packages/flutter_hooks/test/use_animation_controller_test.dart (1)

1-1: Import added for unawaited function.

The dart:async import is correctly added to support the unawaited() function usage.

packages/flutter_hooks/test/use_ticker_provider_test.dart (2)

1-1: LGTM: Import added for async handling improvement.

The addition of dart:async import is necessary for using the unawaited function on line 49.


46-49: Excellent improvement in async handling clarity.

The reformatting with trailing commas improves readability, and wrapping animationController.forward() with unawaited() makes the intent explicit that we don't want to await the animation completion. This prevents linter warnings and clearly communicates the asynchronous behavior.

packages/flutter_hooks/test/use_expansible_controller_test.dart (3)

12-12: Correct update to use the new hook.

Properly updated to use useExpansibleController() instead of the deprecated useExpansionTileController().


27-27: Debug string updated consistently.

The debug property string correctly reflects the new hook name and controller type.


33-66: Comprehensive test updates for the new hook.

All test references have been correctly updated from the deprecated useExpansionTileController to the new useExpansibleController hook. The test logic remains unchanged, ensuring behavioral consistency while adopting the new API.

packages/flutter_hooks/test/use_transformation_controller_test.dart (1)

23-44: Good improvement in test robustness.

Using anyOf() to accept multiple diagnostic string formats makes the test more resilient to different Flutter versions or matrix formatting styles. This prevents test brittleness while maintaining verification of the core functionality.

README.md (2)

358-358: Documentation properly updated for the new hook.

The README correctly reflects the renaming from useExpansionTileController to useExpansibleController, with updated link and description that accurately describes creating an ExpansibleController.


361-361: Minor formatting improvement.

The addition of bold formatting to **CarouselController** improves consistency with other controller descriptions in the table.

packages/flutter_hooks/lib/src/misc.dart (1)

4-98: LGTM! Generic parameter renaming is consistent and well-executed.

The renaming from State/Action to StateT/ActionT improves clarity and follows common naming conventions for generic type parameters. The changes are consistently applied across the Store interface, useReducer function, and all internal hook classes.

packages/flutter_hooks/lib/src/expansion_tile_controller.dart (3)

3-9: LGTM! Well-documented new hook function.

The new useExpansibleController function is properly implemented with appropriate documentation and follows the established patterns for controller hook functions.


15-18: LGTM! Proper deprecation handling.

The deprecation is well-implemented:

  • Clear deprecation annotation with migration guidance
  • Proper delegation to the new implementation to avoid code duplication
  • Maintains backward compatibility during the transition period

20-37: LGTM! Hook implementation properly updated.

The hook classes have been correctly renamed and updated:

  • _ExpansibleControllerHook replaces the old implementation
  • Controller type properly changed to ExpansibleController
  • Debug label updated to reflect the new naming
  • State management remains consistent with the established pattern

environment:
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.21.0-13.0.pre.4"
flutter: ">=3.32.0"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the Flutter SDK version requirement.

The update from ">=3.21.0-13.0.pre.4" to ">=3.32.0" represents a significant version jump. Please ensure that Flutter 3.32.0 is a valid, released version and that this requirement aligns with the package's actual dependencies.


🌐 Web query:

What is the latest stable version of Flutter as of June 2025?

💡 Result:

As of June 2025, the latest stable version of Flutter is 3.29.0, released on February 12, 2025. (groups.google.com) This release introduced several enhancements, including:

  • Rendering Engine Update: Flutter now runs Dart code on the platform's main thread for both Android and iOS, improving platform interop through direct synchronous calls. (codewithandrea.com)

  • Cupertino and Material Widgets Refinements: The update brought refinements to Cupertino and Material widgets, along with DevTools enhancements and Impeller engine optimizations. (codewithandrea.com)

  • Deprecation of Certain Packages: In an effort to focus on the core framework, the Flutter team announced the discontinuation of support for several official packages, effective April 30, 2025. (codewithandrea.com)

To upgrade to Flutter 3.29.0, you can run the following command in your terminal:

flutter upgrade

For a comprehensive list of changes and updates in this release, refer to the official Flutter release notes. (docs.flutter.dev)

Citations:


Invalid Flutter SDK Version Constraint

The SDK constraint in packages/flutter_hooks/pubspec.yaml requires Flutter >=3.32.0, but Flutter 3.32.0 hasn’t been released. The latest stable version as of June 2025 is 3.29.0.

Please update the constraint accordingly:

- flutter: ">=3.32.0"
+ flutter: ">=3.29.0"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
flutter: ">=3.32.0"
flutter: ">=3.29.0"
🤖 Prompt for AI Agents
In packages/flutter_hooks/pubspec.yaml at line 10, the Flutter SDK version
constraint is set to ">=3.32.0", which is invalid because Flutter 3.32.0 has not
been released yet. Update the version constraint to ">=3.29.0" to reflect the
latest stable Flutter version as of June 2025.

@rrousselGit rrousselGit merged commit e802dd3 into master Jun 2, 2025
4 checks passed
@rrousselGit rrousselGit deleted the lints branch June 2, 2025 15:38
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