Skip to content

Conversation

@marcossevilla
Copy link
Member

@marcossevilla marcossevilla commented Jun 3, 2025

Migration details

Flutter 3.32.0 changed the signature of Navigator.removeRouteBelow which caused a compile time error flutter/flutter#157725.

// Before:
when(() => navigator.removeRouteBelow(any())).thenAnswer((_) {});

// After:
when(
  () => navigator.removeRouteBelow<Object?>(any(), any()),
).thenAnswer((_) {});

Status

READY

Description

Closes #96.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Summary by CodeRabbit

  • Dependency Updates

    • Updated Dart SDK constraint to 3.8.0 and Flutter SDK constraint to 3.32.0.
    • Upgraded dependencies: matcher, equatable, flutter_bloc, and very_good_analysis.
  • Bug Fixes

    • Improved compatibility with the latest Flutter and Dart versions.
  • Refactor

    • Improved code formatting for better readability in several files.
  • Tests

    • Added a new test to verify the mocking of the .removeRoute method.
    • Updated existing tests to align with new method signatures.
  • Chores

    • Updated GitHub Actions workflows to use Flutter 3.32.0.
    • Simplified analysis options configuration.

@marcossevilla marcossevilla self-assigned this Jun 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 3, 2025

Walkthrough

The updates standardize and upgrade environment constraints, dependency versions, and analysis options across the project and its example. The _MockNavigatorState class is updated to align navigation method signatures with Flutter 3.32.0, and corresponding tests are added and refactored for these changes. Workflow configurations are also updated to use Flutter 3.32.0.

Changes

File(s) Change Summary
.github/workflows/example.yaml, .github/workflows/main.yaml Updated workflow to use Flutter 3.32.0 explicitly.
analysis_options.yaml, example/analysis_options.yaml Changed included analysis options file from version-specific to generic very_good_analysis/analysis_options.yaml.
pubspec.yaml, example/pubspec.yaml Updated Dart SDK to 3.8.0, Flutter SDK to 3.32.0, and bumped dependencies (matcher, equatable, flutter_bloc, very_good_analysis).
lib/src/matchers.dart Reformatted multiline ternary expressions for compactness; no logic changes.
lib/src/mock_navigator.dart Updated removeRouteBelow and added removeRoute with generic parameters and optional result, matching Flutter 3.32.0 signatures.
test/src/mock_navigator_test.dart Refactored widget builder formatting; added test for .removeRoute; updated .removeRouteBelow test to match new signature.

Sequence Diagram(s)

sequenceDiagram
  participant TestSuite
  participant MockNavigator
  participant _MockNavigatorState

  TestSuite->>MockNavigator: set up stub for removeRoute<T>(route, [result])
  TestSuite->>TestSuite: pump widget with TextButton(onPressed: Navigator.of(context).removeRoute(testRoute))
  TestSuite->>TestSuite: tap TextButton
  TestSuite->>_MockNavigatorState: removeRoute(testRoute)
  _MockNavigatorState->>MockNavigator: forward removeRoute<T>(route, [result])
  TestSuite->>MockNavigator: verify removeRoute<T>(testRoute) called once
Loading

Possibly related issues

  • fix: Incompatible with Flutter 3.32.0 #96: Updates _MockNavigatorState methods to match new generic signatures and optional result parameters introduced in Flutter 3.32.0, resolving related compilation errors.

Poem

Flutter hops to version three-point-three-two,
MockNavigator learns some new tricks too.
Analysis rules are now up to date,
Dependencies fresh—oh, isn’t that great?
With tests refined and workflows tight,
This rabbit’s code is hopping right!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f575fc1 and 2989040.

📒 Files selected for processing (9)
  • .github/workflows/example.yaml (1 hunks)
  • .github/workflows/main.yaml (1 hunks)
  • analysis_options.yaml (1 hunks)
  • example/analysis_options.yaml (1 hunks)
  • example/pubspec.yaml (2 hunks)
  • lib/src/matchers.dart (1 hunks)
  • lib/src/mock_navigator.dart (1 hunks)
  • pubspec.yaml (1 hunks)
  • test/src/mock_navigator_test.dart (22 hunks)
🔇 Additional comments (15)
example/analysis_options.yaml (1)

1-1: Approve include path update
The include directive now references the generic analysis_options.yaml from the upgraded very_good_analysis package, matching the bump to version 8.0.0.

.github/workflows/main.yaml (1)

25-25: Approve Flutter version bump in CI matrix
The build matrix now includes Flutter 3.32.0, aligning the CI environment with the project’s SDK upgrade.

pubspec.yaml (3)

7-8: Approve SDK constraints update
The Dart SDK constraint was bumped to ^3.8.0 and the Flutter SDK to ^3.32.0, which aligns with the project’s new minimum requirements.


15-15: Approve matcher dependency bump
The matcher package has been updated to ^0.12.17, ensuring compatibility with the new SDK constraints.


20-20: Approve analysis dependency bump
The very_good_analysis dev dependency was updated to ^8.0.0, matching the removal of the version suffix in the analysis options include paths.

.github/workflows/example.yaml (1)

23-23: Approve Flutter version pin in example workflow
Adding flutter_version: "3.32.0" ensures the example build uses the same SDK version as the main CI.

analysis_options.yaml (1)

1-1: Approve include path update
The root analysis options now include the generic file from very_good_analysis, consistent with the package upgrade.

example/pubspec.yaml (2)

7-8:

Details

✅ Verification successful

Verify SDK and Flutter version compatibility.

The SDK constraint was updated to ^3.8.0 and Flutter constraint added as ^3.32.0. Please ensure these versions are compatible and that all dependencies support these constraints.


🌐 Web query:

What are the minimum Dart SDK requirements for Flutter 3.32.0?

💡 Result:

Flutter 3.32.0, released on May 20, 2025, requires Dart SDK version 3.8.0. This can be understood from several pieces of evidence in the search results.

When users try to install or upgrade to Flutter 3.32.0, they may encounter compatibility issues with older Dart SDK versions. One user reported being unable to upgrade because their system was trying to install Dart 3.7.0, but Flutter 3.32.0 needs Dart 3.8.0[5].

This is further confirmed by a GitHub issue where developers were working on the Flutter 3.32 candidate branch. The issue mentions rolling in Dart SDK 3.8.0 as part of the release preparation[4]. Specifically, a developer triggered an "autoroller" to version 3.8.0-278.0.dev to check compatibility.

The Shorebird blog post explicitly states that they now fully support "Flutter 3.32.0 and Dart 3.8," indicating this is the required Dart version for this Flutter release[6].

This pattern is consistent with how Flutter manages its dependencies. In Flutter projects, the pubspec.yaml file contains an environment section that specifies SDK version constraints, and when there's a mismatch between the required and installed SDK versions, users will see an error message like "Local package requires a higher minimum version of the Dart SDK"[7].

For developers wanting to use Flutter 3.32.0, they should ensure they have Dart SDK 3.8.0 or higher installed to avoid compatibility issues.

Citations:


Pubspec environment verified

Confirmed that Flutter 3.32.0 requires Dart SDK ≥ 3.8.0. Your environment block in example/pubspec.yaml (lines 7–8) correctly specifies:

environment:
  sdk: ^3.8.0
  flutter: ^3.32.0

No changes needed here.


12-12:

Details

✅ Verification successful

Verify dependency version compatibility and security.

Multiple dependencies have been updated. Please verify these versions are compatible with Flutter 3.32.0 and check for any security advisories.

Also applies to: 15-15, 25-25


🏁 Script executed:

#!/bin/bash
# Description: Check for security advisories and compatibility for updated dependencies

echo "Checking equatable 2.0.7..."
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: PUB, package: "equatable") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

echo "Checking flutter_bloc 9.1.1..."
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: PUB, package: "flutter_bloc") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

echo "Checking very_good_analysis 8.0.0..."
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: PUB, package: "very_good_analysis") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Length of output: 1257


🏁 Script executed:

#!/usr/bin/env bash
echo "=== example/pubspec.yaml (lines 1–50) ==="
sed -n '1,50p' example/pubspec.yaml

Length of output: 651


🏁 Script executed:

#!/usr/bin/env bash
set -e

echo "Equatable 2.0.7 environment constraints:"
curl -s https://pub.dev/api/packages/equatable/versions/2.0.7 | jq '.pubspec.environment'

echo ""
echo "Flutter_bloc 9.1.1 environment constraints:"
curl -s https://pub.dev/api/packages/flutter_bloc/versions/9.1.1 | jq '.pubspec.environment'

echo ""
echo "Very_good_analysis 8.0.0 environment constraints:"
curl -s https://pub.dev/api/packages/very_good_analysis/versions/8.0.0 | jq '.pubspec.environment'

echo ""
echo "Universal_io 2.2.2 environment constraints:"
curl -s https://pub.dev/api/packages/universal_io/versions/2.2.2 | jq '.pubspec.environment'

Length of output: 925


Dependency compatibility & security verified

  • Checked GitHub’s security advisories for equatable 2.0.7, flutter_bloc 9.1.1, very_good_analysis 8.0.0, and universal_io 2.2.2 – no known vulnerabilities found.
  • Confirmed environment constraints against sdk: ^3.8.0 & flutter: ^3.32.0 (from example/pubspec.yaml):
    • equatable 2.0.7 (sdk >=2.12.0 <4.0.0)
    • flutter_bloc 9.1.1 (sdk >=2.14.0 <4.0.0)
    • very_good_analysis 8.0.0 (sdk ^3.7.0 → >=3.7.0 <4.0.0)
    • universal_io 2.2.2 (sdk >=2.17.0 <4.0.0)

All dependencies are compatible with Flutter 3.32.0 and secure. No further changes needed.

lib/src/matchers.dart (1)

287-294: LGTM! Improved code formatting.

The ternary expressions have been reformatted to be more compact and readable while maintaining the same logic. This is a good improvement to code style.

Also applies to: 298-305

lib/src/mock_navigator.dart (2)

322-324: LGTM! New removeRoute method aligns with Flutter 3.32.0.

The new generic removeRoute method with optional result parameter correctly forwards to the internal navigator mock. This aligns with Flutter 3.32.0 NavigatorState API changes.


327-328: LGTM! Updated removeRouteBelow signature.

The method signature has been updated to include generic type parameter and optional result parameter, maintaining consistency with the new removeRoute method and Flutter 3.32.0 API.

test/src/mock_navigator_test.dart (3)

56-59: LGTM! Improved test formatting consistency.

The TextButton builder closures have been consolidated to single-line expressions for better consistency and readability across all test cases.

Also applies to: 71-74, 88-93, 112-115, 129-133, 145-148, 162-165, 177-180, 192-195, 209-212, 226-229, 243-248, 264-268, 284-288, 304-310, 329-333, 349-356, 375-380, 396-401, 420-426, 448-454, 473-476, 491-494


466-482: LGTM! Comprehensive test coverage for new removeRoute method.

The new test case properly verifies the mocking of the removeRoute method with the correct generic signature, following the established test pattern. The test includes proper setup, interaction, and verification.


485-487: LGTM! Updated test signature aligns with implementation.

The removeRouteBelow test has been correctly updated to use the generic signature with optional result parameter, matching the changes in the mock navigator implementation.


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.

@marcossevilla marcossevilla marked this pull request as ready for review June 3, 2025 10:53
@marcossevilla marcossevilla requested a review from a team as a code owner June 3, 2025 10:53
@marcossevilla marcossevilla mentioned this pull request Jun 3, 2025
7 tasks
@alestiago
Copy link
Contributor

alestiago commented Jun 3, 2025

@marcossevilla, I would like to honor @Conrad598 as a contributor to this upgrade given his efforts on #97. Could you make a commit that adds @Conrad598 as a contributor?

There is a way to do this without needing his input, you can find his Git email by looking at a .patch of one of his commits, for example on 65a558bd94a8346c1582c65dc0e45174691b9d91 and then having a commit that adds him as a "Co-author".

@alestiago alestiago changed the title chore: upgrade to flutter 3.32.0 chore!: upgrade to flutter 3.32.0 Jun 3, 2025
@alestiago alestiago changed the title chore!: upgrade to flutter 3.32.0 chore: upgrade to flutter 3.32.0 Jun 3, 2025
@alestiago alestiago changed the title chore: upgrade to flutter 3.32.0 chore!: upgrade to flutter 3.32.0 Jun 3, 2025
Co-authored-by: Conrad Gende <conradg@wilcoxind.com>
@marcossevilla marcossevilla merged commit 388f94d into main Jun 3, 2025
8 checks passed
@marcossevilla marcossevilla deleted the chore/flutter-3.32 branch June 3, 2025 12:23
@coderabbitai coderabbitai bot mentioned this pull request Jun 3, 2025
7 tasks
@alestiago alestiago changed the title chore!: upgrade to flutter 3.32.0 chore!: upgrade to Flutter 3.32.0 Jun 3, 2025
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.

fix: Incompatible with Flutter 3.32.0

3 participants