Skip to content

fix: keep Pick.saveFile source-compatible with file_picker 12#101

Merged
anilcancakir merged 3 commits into
masterfrom
fix/pick-savefile-non-null
Jun 25, 2026
Merged

fix: keep Pick.saveFile source-compatible with file_picker 12#101
anilcancakir merged 3 commits into
masterfrom
fix/pick-savefile-non-null

Conversation

@anilcancakir

Copy link
Copy Markdown
Contributor

Pre-existing master breakage (not introduced by a friction PR). file_picker 12 made FilePicker.saveFile's fileName and bytes parameters required and non-null. A fresh flutter pub get on current CI resolves the newer file_picker, so Pick.saveFile fails analysis with argument_type_not_assignable at lib/src/facades/pick.dart:368-369 (master's Lint & Test is red, see the #96 dep-bump run).

Pick.saveFile keeps its nullable facade signature but guards both arguments before forwarding, so the call type-checks against file_picker 11 and 12 and a null argument fails with a clear ArgumentError instead of an unhelpful type error. Unblocks master CI (and every open magic PR, including #100).

file_picker 12 made FilePicker.saveFile's fileName and bytes required and non-null, breaking the analyzer build under a fresh pub get that resolves the newer file_picker (master CI is currently red on this). Pick.saveFile keeps its nullable facade surface but guards both arguments before forwarding, so it type-checks against file_picker 11 and 12 and fails with a clear ArgumentError on null instead of an unhelpful type error.
Copilot AI review requested due to automatic review settings June 24, 2026 23:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a current analyzer break on master caused by file_picker v12 making FilePicker.saveFile’s fileName and bytes parameters required/non-null, by adding a null-guard in Magic’s Pick.saveFile facade while keeping the facade signature source-compatible.

Changes:

  • Add an early ArgumentError guard in Pick.saveFile when fileName/bytes are null before forwarding to FilePicker.saveFile.
  • Document the fix in CHANGELOG.md under [Unreleased] > Fixed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/src/facades/pick.dart Adds a guard to keep Pick.saveFile compatible across file_picker 11/12.
CHANGELOG.md Adds an unreleased “Fixed” entry describing the compatibility change.

Comment thread lib/src/facades/pick.dart
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@anilcancakir anilcancakir force-pushed the fix/pick-savefile-non-null branch from 9f84b19 to 8baa6aa Compare June 25, 2026 00:13
@anilcancakir anilcancakir merged commit 1f55fdb into master Jun 25, 2026
3 checks passed
@anilcancakir anilcancakir deleted the fix/pick-savefile-non-null branch June 25, 2026 00:35
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