Clarify cross_file MIME type docs#11727
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for XFile to clarify that the mimeType property is not automatically inferred from file paths or contents. These updates are reflected in the CHANGELOG.md, README.md, and the base and IO implementations of XFile. Feedback was provided to improve the clarity of the documentation in the XFile constructors by explicitly stating that the mimeType is only available if passed to the constructor, and to ensure consistency by applying similar updates to the HTML implementation.
| /// [mimeType] is not inferred from [path] and is returned from [mimeType] | ||
| /// only if explicitly passed. |
There was a problem hiding this comment.
The phrasing "returned from [mimeType]" is confusing because [mimeType] is used for both the parameter and the property in this context. It would be clearer to state that the property is only available if the parameter is provided. Additionally, for consistency, please consider applying similar documentation updates to the XFile constructors in lib/src/types/html.dart.
| /// [mimeType] is not inferred from [path] and is returned from [mimeType] | |
| /// only if explicitly passed. | |
| /// [mimeType] is not inferred from [path] and is only available if explicitly | |
| /// passed to the constructor. |
There was a problem hiding this comment.
I updated the wording in io.dart and added matching constructor documentation in html.dart. Tests still pass.
|
|
||
| /// Construct an CrossFile from its data | ||
| /// | ||
| /// [mimeType] is returned from [mimeType] only if explicitly passed. |
There was a problem hiding this comment.
The phrasing "returned from [mimeType]" is redundant. It's clearer to specify that the value is only available if provided during construction.
| /// [mimeType] is returned from [mimeType] only if explicitly passed. | |
| /// [mimeType] is only available if explicitly passed to the constructor. |
ddb605b to
1a79271
Compare
|
Thanks for the contribution! You’ve checked boxes in the PR checklist above that are not reflected in this PR, so I’m assuming this is a work in progress and am marking it as a Draft. Please review the checklist, updating the PR as appropriate, and when the state of the PR as posted reflects the checklist please feel free to mark it as ready for review. |
Clarifies the
cross_filedocumentation forXFile.mimeType.This PR documents that
mimeTypeis not inferred from the file path or file contents. It is only available when provided while creating theXFile, or when available from the platform-backed file.Fixes flutter/flutter#93379
Pre-Review Checklist
[shared_preferences]///).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-assistbot 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
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