Skip to content

[cross_file] Document native mimeType behavior#11662

Open
faheemabbas766 wants to merge 6 commits into
flutter:mainfrom
faheemabbas766:cross-file-document-mimetype-native
Open

[cross_file] Document native mimeType behavior#11662
faheemabbas766 wants to merge 6 commits into
flutter:mainfrom
faheemabbas766:cross-file-document-mimetype-native

Conversation

@faheemabbas766

@faheemabbas766 faheemabbas766 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Clarifies that XFile.mimeType is not inferred from file paths or file contents on native platforms.

For native/io implementations, mimeType returns the value explicitly passed to XFile or XFile.fromData, if any. This matches the existing behavior and documents the expectation raised in flutter/flutter#93379.

Fixes flutter/flutter#93379

Tests

dart analyze
dart test
cd example && dart test

Notes

This PR only updates documentation comments, so no version/CHANGELOG update or new test is required.

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under1.
  • All existing and new tests are passing.

Footnotes

  1. This PR only updates documentation comments, so no version/CHANGELOG update or new test is required. 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 updates the XFile documentation to clarify that native implementations do not infer MIME types from file paths or contents. Review feedback recommends refining the documentation in io.dart to explicitly state that the mimeType property returns the value provided to the constructor, avoiding circular phrasing.

Comment thread packages/cross_file/lib/src/types/io.dart Outdated
Comment thread packages/cross_file/lib/src/types/io.dart Outdated
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

[x] I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or this PR only updates documentation/comments and does not require a version or CHANGELOG update.

This is not the text of our PR checklist.

The purpose of the checklist is to guide contributors through our required process. Editing the checklist to remove our requirements defeats the purpose.

Once you've completed our checklist as it is actually written, please mark the PR as ready for review.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft May 7, 2026 14:45
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

The web test was not run successfully locally because dart test -p chrome could not locate a chrome executable in this environment.

Also, please take a moment to re-read the section of the AI contribution guidelines about reviewing AI output, and not uncritically reposting whatever the AI outputs.

@faheemabbas766

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution!

[x] I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or this PR only updates documentation/comments and does not require a version or CHANGELOG update.

This is not the text of our PR checklist.

The purpose of the checklist is to guide contributors through our required process. Editing the checklist to remove our requirements defeats the purpose.

Once you've completed our checklist as it is actually written, please mark the PR as ready for review.

Thanks for pointing that out. I restored the original checklist wording and added a short note for the documentation-only exception.

@faheemabbas766 faheemabbas766 marked this pull request as ready for review May 8, 2026 04:09

@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 updates the documentation for XFile to clarify that mimeType is not inferred from file paths or contents on native platforms. Review feedback suggests improving the accuracy of the documentation in the base class and clarifying the phrasing in the XFile constructor to avoid ambiguity.

Comment thread packages/cross_file/lib/src/types/base.dart Outdated
Comment thread packages/cross_file/lib/src/types/io.dart Outdated
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

and added a short note for the documentation-only exception

Could you point me to the specific text in the contribution docs about changelogs and versions that you are referring to here?

Also, you indicated in the first checkbox that you read those docs; did that include the FAQ section?

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

From triage: @faheemabbas766 Are you still planning on updating this PR to address the feedback?

faheemabbas766 and others added 5 commits June 1, 2026 14:56
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@faheemabbas766 faheemabbas766 force-pushed the cross-file-document-mimetype-native branch from 695dfb8 to b556bd3 Compare June 1, 2026 10:04
@faheemabbas766

Copy link
Copy Markdown
Contributor Author

From triage: @faheemabbas766 Are you still planning on updating this PR to address the feedback?

Thanks for the follow-up. I re-read the version/CHANGELOG instructions, including the FAQ, and you were right that this public /// API documentation update needs package release info.

I've pushed an update that:

bumps cross_file to 0.3.5+3
adds a CHANGELOG.md entry for the XFile.mimeType documentation clarification
Keeps the existing documentation wording updates from the review feedback
rebases the branch on the latest upstream/main to resolve the CHANGELOG.md conflict
I also ran dart run script/tool/bin/flutter_plugin_tools.dart analyze --packages=cross_file locally, and it passed with no issues.

@bparrishMines bparrishMines added the CICD Run CI/CD label Jun 11, 2026

@bparrishMines bparrishMines 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.

LGTM

I'm generally fine with this. This is reasonable documentation for how the current implementation handles this. And we don't plan on changing this for this major version because #11010 removes this value anyways.

@stuartmorgan-g @tarrinneal For secondary review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cross_file] Document that mimeType is not expected to be set for io implementation

3 participants