Skip to content

[cross_file] Document native mimeType behavior#11662

Open
faheemabbas766 wants to merge 4 commits intoflutter:mainfrom
faheemabbas766:cross-file-document-mimetype-native
Open

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

Conversation

@faheemabbas766
Copy link
Copy Markdown

@faheemabbas766 faheemabbas766 commented May 7, 2026

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

Copy link
Copy Markdown

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

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
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@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
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
Copy link
Copy Markdown

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

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
faheemabbas766 and others added 2 commits May 8, 2026 14:18
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>
@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?

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.

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

2 participants