Support Flutter 3.44+ (IconData is now a final class) - #66
Open
hiake21c wants to merge 1 commit into
Open
Conversation
Flutter 3.44 marked `IconData` a `final class` (flutter/flutter#181342), which makes `class PhosphorIconData extends IconData` illegal and breaks every build on Flutter 3.44+. Icons are now plain `IconData` instances: the generated style classes emit `IconData(...)` directly (identical codePoint/fontFamily/fontPackage, so flat icons render unchanged), and `PhosphorIconData` / `PhosphorFlatIconData` / `PhosphorDuotoneIconData` are kept as type aliases for backward compatibility. Bumps the SDK floor to Dart 3.0 (non-function typedefs) and Flutter 3.44. Tradeoff: duotone icons collapse to their foreground layer (single-tone), since a plain `IconData` cannot carry the second layer. A two-tone-preserving approach is possible but requires a breaking `PhosphorIcon` widget redesign; this change prioritizes unblocking Flutter 3.44 builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Flutter 3.44 marked
IconDataafinal class(flutter/flutter#181342). The package's core type does:Extending a
finalclass is now a compile error, so every build on Flutter 3.44+ fails:Fix
Icons become plain
IconDatainstances instead of anIconDatasubclass. The generated style classes now emitIconData(...)directly with the identicalcodePoint/fontFamily/fontPackage, so flat icons render unchanged.PhosphorIconData,PhosphorFlatIconDataandPhosphorDuotoneIconDataare kept as type aliases for backward compatibility. SDK floor bumped to Dart 3.0 (non-function typedefs) / Flutter 3.44.Tradeoff (needs a maintainer decision)
Because a plain
IconDatacannot carry a second layer, duotone icons collapse to their foreground layer (single-tone) in this PR. Preserving true two-tone rendering is possible but requires a breakingPhosphorIconredesign (duotone can no longer be anIconData, soIcon(duotoneConst)and thePhosphorIcon extends Iconrelationship both change). I kept this PR minimal to unblock 3.44 builds — happy to extend it to a duotone-preserving design if you prefer that direction.Notes