Skip to content

[cross_file] Add runnable example with main() - #11527

Merged
auto-submit[bot] merged 6 commits into
flutter:mainfrom
momshaddinury:main
Jul 1, 2026
Merged

[cross_file] Add runnable example with main()#11527
auto-submit[bot] merged 6 commits into
flutter:mainfrom
momshaddinury:main

Conversation

@momshaddinury

Copy link
Copy Markdown
Contributor

Adds a main() entry point and an XFile.fromData demonstration to the cross_file example, so pub.dev's Pana scoring recognises that the package ships with an example.

The existing readme_excerpts.dart defined instantiateXFile() but had no top-level main(), so the file wasn't discovered as an example. This keeps the existing #docregion Instantiate block used by README.md and adds a second #docregion InstantiateFromData block alongside a main() that runs both excerpts.

The new test exercises XFile.fromData on every platform (the existing path-based test is skipped on web, which has no filesystem).

Fixesflutter/flutter#93073

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-assistgemini-code-assistBot 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 cross_file package example by adding a runnable main entry point and a demonstration of XFile.fromData for in-memory byte construction. Corresponding tests were added to verify the new functionality. Feedback includes removing redundant type arguments in the byte list initialization and wrapping the disk-based file instantiation in a try-catch block to improve robustness across platforms like the web.

Comment threadpackages/cross_file/example/lib/readme_excerpts.dart Outdated
Comment threadpackages/cross_file/example/lib/main.dart
@momshaddinury
momshaddinuryforce-pushed the main branch 2 times, most recently from 9d29218 to afb5116CompareApril 18, 2026 06:44

@stuartmorgan-gstuartmorgan-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.

Thanks for the contribution!

We want examples to be easily discoverable by users, and also to show up on pub.dev, so a main entry point for an example should be in lib/main.dart. If we only need one file, the file should be renamed.

Comment threadpackages/cross_file/example/lib/main.dart
Comment threadpackages/cross_file/CHANGELOG.md Outdated
Comment threadpackages/cross_file/CHANGELOG.md Outdated
Comment threadpackages/cross_file/example/lib/main.dart Outdated
Comment threadpackages/cross_file/example/lib/main.dart
Comment threadpackages/cross_file/example/lib/main.dart Outdated
Comment threadpackages/cross_file/CHANGELOG.md Outdated
@momshaddinury

Copy link
Copy Markdown
ContributorAuthor

@stuartmorgan-g I was caught up with another PR. Will address the feedback this week.

@bparrishMinesbparrishMines added the CICD Run CI/CD label May 20, 2026
@momshaddinury

Copy link
Copy Markdown
ContributorAuthor

@stuartmorgan-g, is there any update to this issue? LMK if there's any feedback.

@bparrishMinesbparrishMines 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

@bparrishMinesbparrishMines added the CICD Run CI/CD label Jun 12, 2026
@github-actionsgithub-actionsBot removed the CICD Run CI/CD label Jun 12, 2026
@momshaddinury

momshaddinury commented Jun 12, 2026

Copy link
Copy Markdown
ContributorAuthor

@bparrishMines, can you please add the CICD label again?

@bparrishMinesbparrishMines added the CICD Run CI/CD label Jun 12, 2026
@momshaddinury

Copy link
Copy Markdown
ContributorAuthor

@bparrishMines fixed the failed readme snippet validation. Resolved the conflict. Please add the CICD label again. Thanks.

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

Copy link
Copy Markdown
Contributor

@stuartmorgan-g For the final review

@flutter-dashboardflutter-dashboardBot removed the CICD Run CI/CD label Jul 1, 2026
@stuartmorgan-gstuartmorgan-g added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Jul 1, 2026
@auto-submit
auto-submitBot merged commit b967797 into flutter:mainJul 1, 2026
88 checks passed
pullBot pushed a commit to Klomgor/flutter that referenced this pull request Jul 2, 2026
…er#188916)
flutter/packages@e742106...420e135
2026-07-02 dkwingsmt@users.noreply.github.com [material_ui] Migrate api
sample code to @example dartdoc directive (flutter/packages#12078)
2026-07-02 dkwingsmt@users.noreply.github.com [material_ui] Move over
more API samples (flutter/packages#12092)
2026-07-01 katelovett@google.com [cupertino_ui] Migrate api sample code
to @example dartdoc directive (flutter/packages#12063)
2026-07-01 katelovett@google.com [cupertino_ui] Move over more API
samples (flutter/packages#12086)
2026-07-01 48776784+mackings@users.noreply.github.com
[two_dimensional_scrollables] Fix TreeView horizontal hit testing
(flutter/packages#11859)
2026-07-01 1063596+reidbaker@users.noreply.github.com
[camera_android_camerax][tool] Integrate dart_code_linter for cyclomatic
complexity checks (flutter/packages#11999)
2026-07-01 dinurymomshad.dev@gmail.com [cross_file] Add runnable example
with main() (flutter/packages#11527)
2026-07-01 36861262+QuncCccccc@users.noreply.github.com [cupertino_ui]
Enable `switch_test.dart` (flutter/packages#12076)
2026-07-01 jmccandless@google.com [cupertino_ui] Re-enable
dialog_test.dart (flutter/packages#12057)
2026-07-01 jmccandless@google.com [cupertino_ui] Re-enable
action_sheet_test.dart (flutter/packages#12055)
2026-07-01 rmolivares@renzo-olivares.dev [cupertino_ui] Migrate
`bottom_tab_bar_test.dart` to `SemanticsHandle` (flutter/packages#12012)
2026-07-01 1063596+reidbaker@users.noreply.github.com [repo] Add comment
style guideline to AGENTS.md (flutter/packages#12077)
2026-07-01 43054281+camsim99@users.noreply.github.com Adds pre-push
readiness skill (flutter/packages#11935)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.
To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit AppCICDRun CI/CDp: cross_file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cross_file] No example

3 participants

@momshaddinury@bparrishMines@stuartmorgan-g