fix(theme): import CupertinoPageTransitionsBuilder explicitly (unbreaks analyze on Flutter 3.44.x) - #246
Conversation
CI is pinned to Flutter 3.41.6, where material.dart re-exports
CupertinoPageTransitionsBuilder, so this is green on the pin and is not a
broken build. On 3.44.x that re-export is gone and `flutter analyze` fails
with "The function 'CupertinoPageTransitionsBuilder' isn't defined", plus 4
knock-on errors as the surrounding `const` PageTransitionsTheme map loses its
constant value. Anyone developing on current stable hits 5 errors in a file
they did not touch.
theme.dart already predicted exactly this and wrote down the remedy:
// ...so if you bump the pin and this suddenly fails to resolve, re-add:
// import 'package:flutter/cupertino.dart' show CupertinoPageTransitionsBuilder;
This is that import, taken rather than left as a comment, so the file no longer
depends on which library happens to re-export the symbol this month.
Safe on both toolchains: material.dart re-exports the SAME declaration, and
Dart reports an ambiguity only when two DIFFERENT declarations share a name, so
the pin sees one element reachable by two routes. The `show` clause is
load-bearing — an unscoped cupertino import would genuinely collide with
material, which declares its own Card, Switch and Divider.
Verified on 3.44.6: `flutter analyze lib/` goes from 5 errors to clean, and
test/boot_splash_test.dart (which builds the theme) passes. Not verifiable
locally on 3.41.6 — CI covers that, and the reasoning above is why it should
be a no-op there.
Scope: this does NOT address the separate phosphor_flutter 2.1.0 breakage on
newer Flutter (PhosphorIconData extends IconData, now a final class), which
blocks widget tests independently of this file.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrVjCqVDMANK5sa5eyjATw
|
Warning Review limit reached
Next review available in: 49 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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. Comment |
Not a CI break — a "current stable" break
CI is pinned to Flutter 3.41.6, where
material.dartre-exportsCupertinoPageTransitionsBuilder. On the pin this file is fine andmainis green.On 3.44.x that re-export is gone, and
flutter analyzereports 5 errors in afile the contributor never touched:
One missing symbol, then four knock-on errors as the surrounding
const PageTransitionsThememap loses its constant value.The fix is the one this file already wrote down
theme.dartpredicted this precisely and left the remedy in a comment:This PR takes that import instead of leaving it as an instruction, so the file no
longer depends on which library happens to re-export the symbol in a given release.
The comment above it is updated to explain why the import is now unconditional.
Why this is safe on the pinned toolchain too
material.dartre-exports the same declaration. Dart reports an ambiguity onlywhen two different declarations share a name, so on 3.41.6 the analyzer simply
sees one element reachable by two routes — not a conflict.
showclause is load-bearing. An unscopedimport 'package:flutter/cupertino.dart';would collide with material, which declares its own
Card,Switch,Dividerandothers. Only the one symbol is pulled in.
Verification
On Flutter 3.44.6:
flutter analyze lib/— 5 errors → cleanflutter test test/boot_splash_test.dart(builds the theme) — 4 passedI could not test on 3.41.6 locally; CI covers that, and the reasoning above is why it
should be a no-op there. If CI disagrees I'd rather find out on this one-line change
than inside a feature PR.
Out of scope
This does not fix the separate
phosphor_flutter2.1.0 breakage on newer Flutter —class PhosphorIconData extends IconDatafails now thatIconDataisfinal, whichblocks widget tests independently of this file. That needs a dependency bump and is a
different change; flagging it since it is the other thing a contributor on current
stable will hit immediately.