Skip to content

[cross_file_darwin] iOS/macOS implementation of cross_file - #12910

Open
bparrishMines wants to merge 15 commits into
flutter:mainfrom
bparrishMines:cross_file_darwin
Open

bparrishMines wants to merge 15 commits into
flutter:mainfrom
bparrishMines:cross_file_darwin

Conversation

@bparrishMines

@bparrishMines bparrishMines commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Part of flutter/flutter#91869

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the cross_file_darwin package, providing a Darwin-specific implementation for the cross_file plugin, including support for security-scoped resources and PhotoKit assets. The implementation uses Pigeon for communication between Dart and native code, along with FFI for native asset resource management. The review identified several critical issues, including a missing delegate assignment in AssetResourceReader, incorrect URI-to-file-path conversions in canRead methods, a missing return statement in lastModified, and inconsistent parameter usage in helper methods within darwin_scoped_storage_cross_file.dart.

Comment on lines +14 to +15
func openRead(localIdentifier: String, delegate: AssetResourceReaderDelegate) -> Bool {
let assets = PHAsset.fetchAssets(withLocalIdentifiers: [localIdentifier], options: nil)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The delegate parameter passed to openRead is never assigned to self.delegate. As a result, self.delegate remains nil, and the callbacks onDataReceived and onCompletion are never triggered.

  func openRead(localIdentifier: String, delegate: AssetResourceReaderDelegate) -> Bool {
    self.delegate = delegate
    let assets = PHAsset.fetchAssets(withLocalIdentifiers: [localIdentifier], options: nil)

@bparrishMines bparrishMines Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

very good catch. This is the down side of not being able to write tests when the api requires out of app user interactions.

@bparrishMines bparrishMines changed the title darwin impl [cross_file_darwin] iOS/macOS implementation of cross_file Sep 17, 2026

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Comment thread packages/cross_file/cross_file_darwin/CONTRIBUTING.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants