agentleFS
ariaraminariaramin/flutter-skills/skills/flutter-share-plus-engineering/SKILL.md

flutter-share-plus-engineering

Skill8 starsChanged 48 days agoMITView on GitHub

Design, implement, review, debug, secure, test, migrate, and optimize production cross-platform sharing in Flutter with share_plus. Use when a task involves SharePlus.instance.share, ShareParams, text or URI sharing, images/PDFs/generated documents/audio/video, XFile or XFile.fromData, multiple attachments, MIME types and filenames, iPad/macOS sharePositionOrigin, Web Share API and download/email fallbacks, Windows or Linux sharing, ShareResult semantics, temporary-file cleanup, large-file memory use, duplicate share sheets, receiver compatibility, privacy, or migration from deprecated Share.* APIs. Do not use for receiving inbound shares, guaranteed delivery workflows, direct posting through a social network SDK/API, or generic file export with no share handoff.

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. About 0 are common, 16 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat sharing as a transition across an application trust boundary.

    line 8
  2. Very specific:

    Use the installed package API, README, and changelog as the source of truth when the repository differs, especially for current API shape, …

    line 31
  3. Very specific:

    Use the current SharePlus.instance.share(ShareParams(...)) API.

    line 37
  4. Distinctive:

    Do not assume capability or result parity across Android, Apple, Web, Linux, and Windows.

    line 38
  5. Very specific:

    Prefer a path-backed XFile when a large file already exists.

    line 40
  6. Very specific:

    Never call readAsBytes() solely to wrap an existing file in XFile.fromData.

    line 41
  7. Very specific:

    Use XFile.fromData for genuinely in-memory or generated content, and give it an accurate MIME type and meaningful filename.

    line 43
  8. Distinctive:

    Do not claim path-backed sharing is zero-copy.

    line 45
  9. Very specific:

    Keep expensive generation, compression, file I/O, and sharing out of build().

    line 47
  10. Distinctive:

    Keep Web sharing directly tied to transient user activation.

    line 49
  11. Very specific:

    Treat ShareResult as best-effort interaction feedback, not delivery or business confirmation.

    line 54
  12. Distinctive:

    Treat dismissal as normal user behavior.

    line 56
  13. Very specific:

    Treat subject, title, MIME hints, filenames, and multi-attachment support as receiver-dependent.

    line 57
  14. Distinctive:

    Never share access tokens, refresh tokens, credentials, private keys, or unreviewed sensitive content.

    line 59
  15. Distinctive:

    Treat private and signed URLs as bearer-like information once shared.

    line 61
  16. Very specific:

    Do not add obsolete Android storage permissions or manual FileProvider setup solely for current share_plus.

    line 66
  17. Distinctive:

    Test real devices and important receiver applications.

    line 68
  18. Distinctive:

    Use this decision order:

    line 73
  19. Very specific:

    Use XFile.fromData for small content that genuinely exists only in memory.

    line 79
  20. Distinctive:

    Use a short-lived signed URL only after reviewing access lifetime and forwarding risk.

    line 82
  21. Distinctive:

    Prefer the first option that preserves product semantics, privacy, platform support, and acceptable memory/disk cost.

    line 86
  22. Very specific:

    Read only the relevant sections of references/production-guide.md.

    line 91
  23. Distinctive:

    Use these search headings:

    line 98
  24. Distinctive:

    Add a share service only when it centralizes actual export caching, privacy, fallback, duplicate prevention, analytics, or testability …

    line 120
  25. Distinctive:

    Keep UI state changes lifecycle-safe and release the in-flight guard in all result and error paths.

    line 126
  26. Distinctive:

    Do not build receiver-specific guarantees on generic share-sheet behavior.

    line 128
  27. Distinctive:

    Run the narrowest relevant Dart/Flutter checks, then test release-like builds on the affected platforms and representative receivers.

    line 132
  28. Very specific:

    Never claim a share was delivered from ShareResultStatus.success.

    line 147

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flutter share_plus Engineering

Treat sharing as a transition across an application trust boundary. After the platform hands content to another application, the Flutter app no longer controls delivery, retention, transformation, or receiver behavior.

Start with evidence

Before changing code:

  1. Inspect pubspec.yaml, pubspec.lock, Flutter/Dart constraints, target platforms, and native toolchain requirements.
  2. Identify the locked share_plus, cross_file, and relevant export/file package versions.
  3. Find every current share invocation, deprecated Share.* call, payload generator, temporary-file owner, Web fallback, result handler, and in-flight guard.
  4. Identify the actual payload semantics: text, URI, existing attachment, generated bytes, generated file, hosted URL, or private signed URL.
  5. Estimate representative payload sizes and inspect byte, disk, compression, isolate, caching, and cleanup paths.
  6. Identify required receiver applications and platform-specific behavior.
  7. Separate verified package behavior from receiver-dependent assumptions.

The bundled guide was validated against share_plus 13.3.0 on 2026-08-11. Use the installed package API, README, and changelog as the source of truth when the repository differs, especially for current API shape, iPad behavior, Web fallback, previewThumbnail, filenames, Windows, and toolchain support.

Preserve these invariants

  • Use the current SharePlus.instance.share(ShareParams(...)) API.
  • Do not assume capability or result parity across Android, Apple, Web, Linux, and Windows.
  • Prefer a path-backed XFile when a large file already exists.
  • Never call readAsBytes() solely to wrap an existing file in XFile.fromData.
  • Use XFile.fromData for genuinely in-memory or generated content, and give it an accurate MIME type and meaningful filename.
  • Do not claim path-backed sharing is zero-copy; Android may copy files into its share cache.
  • Keep expensive generation, compression, file I/O, and sharing out of build().
  • Keep Web sharing directly tied to transient user activation. Prepare expensive Web exports before the final Share click.
  • Provide an accurate source-widget sharePositionOrigin on iPad/macOS when positioning is required; do not use an arbitrary giant rectangle.
  • Allow only one share invocation per control at a time.
  • Treat ShareResult as best-effort interaction feedback, not delivery or business confirmation.
  • Treat dismissal as normal user behavior; never auto-retry it.
  • Treat subject, title, MIME hints, filenames, and multi-attachment support as receiver-dependent.
  • Never share access tokens, refresh tokens, credentials, private keys, or unreviewed sensitive content.
  • Treat private and signed URLs as bearer-like information once shared.
  • Own and clean only application-created temporary exports; never delete the entire shared temporary directory.
  • Surface Web download/email fallback as fallback behavior, not native-share success.
  • Do not add obsolete Android storage permissions or manual FileProvider setup solely for current share_plus.
  • Test real devices and important receiver applications; emulator-only success is insufficient.

Choose the smallest correct payload

Use this decision order:

  1. Share a URI when the hosted experience is the product and the recipient can access it.
  2. Share an existing path-backed file when the recipient needs a standalone attachment.
  3. Use XFile.fromData for small content that genuinely exists only in memory.
  4. Materialize large generated content once to an owned file, then share the path-backed file.
  5. Use a short-lived signed URL only after reviewing access lifetime and forwarding risk.
  6. Choose and label Web fallback explicitly when native Web Share is unavailable.

Prefer the first option that preserves product semantics, privacy, platform support, and acceptable memory/disk cost.

Route to the production guide

Read only the relevant sections of references/production-guide.md. Locate sections before reading them with:

rg -n '^#{1,3} (SECTION|RELATED SECTION)$' references/production-guide.md

Use these search headings:

TaskSearch headings
Install, migrate, inspect capabilities, or use the current API`No Initialization RequiredInstallationCurrent APICurrent Parameter RulesDeprecated APIsSharePlus.custompreviewThumbnailPlatform Capability Matrix`
Share text, URLs, or custom schemes`Basic Text SharingLarge TextText LocalizationURI SharingURL as URI vs TextCustom URI Schemes`
Share existing or multiple files with correct MIME and names`Existing File SharingFile ExistenceMultiple FilesMixed File TypesMIME TypesMIME InferenceExtension and MIME Must AgreeFile NamesfileNameOverrides`
Share generated bytes or manage temporary files and large payloads`In-Memory XFileHow In-Memory Files Are MaterializedXFile.fromData PerformanceWeb File MemoryTemporary FilesSafe Temporary-File StrategyAndroid.s Own Share CacheLarge File PerformanceCPU vs Memory vs Disk`
Implement Android, iOS/iPad, macOS, Web, Linux, or Windows behavior`Android GuidanceAndroid File HandlingAndroid MIME SelectionAndroid PermissionsAndroid FileProvideriOS GuidanceiPad PopoverCorrect sharePositionOriginAsync iPad SafetymacOS GuidanceWeb GuidanceWeb User ActivationWeb Share File CapabilityWeb File FallbackWeb Text/URI Email FallbackLinux GuidanceWindows Guidance`
Interpret results, titles, subjects, and analytics`Share ResultssuccessdismissedunavailableNever Treat Share Result as Business ConfirmationAnalytics BoundarySubject and Title`
Share images, screenshots, PDFs, documents, or remote/private files`ImagesGenerated ImageImage CompressionScreenshotsScreenshot Pixel RatioPDFsGenerated DocumentsCPU-Heavy GenerationRemote FilesSigned URL Decision`
Review privacy, service boundaries, duplicate prevention, or lifecycle`Privacy and SecurityMUST NOT ShareSensitive DocumentsTemporary Sensitive ExportsShare Service AbstractionWhen a Share Service HelpsDuplicate Share SheetsStateful Button ExampleLifecycle SafetyState Management Integration`
Handle errors, fallback, performance, reliability, or accessibility`Error HandlingArgument ErrorsUnsupported CapabilityPlatform ErrorsWeb Fallback FailureGraceful DegradationPerformance RulesReliability RulesReceiver CompatibilityPlatform PermissionsAccessibility and UX`
Test, debug, review, migrate, or prepare production`Testing StrategyCross-Platform Test MatrixiPad Physical TestingAndroid Device TestingWeb Browser VerificationRelease-Build TestingLogging and DiagnosticsDebugging GuideAnti-PatternsImplementation ChecklistCode Review ChecklistProduction Readiness ChecklistVersion-Sensitive Areas`

For a full cross-platform sharing or production-readiness audit, read the entire guide after completing the repository inventory.

Implement at the payload lifecycle boundary

  • Reuse an existing share helper or export path when it already owns real cross-cutting concerns.
  • Add a share service only when it centralizes actual export caching, privacy, fallback, duplicate prevention, analytics, or testability needs.
  • Fix large-file memory spikes at payload generation/materialization rather than micro-optimizing the small plugin invocation.
  • Derive the popover origin from the live initiating widget after asynchronous work, with lifecycle checks.
  • Keep UI state changes lifecycle-safe and release the in-flight guard in all result and error paths.
  • Do not build receiver-specific guarantees on generic share-sheet behavior.

Validate the result

Run the narrowest relevant Dart/Flutter checks, then test release-like builds on the affected platforms and representative receivers. Cover changed paths from this matrix:

  • text, URI, single-file, multi-file, and generated-content payloads;
  • empty/missing files, wrong MIME, receiver rejection, dismissal, and unavailable capability;
  • iPad/macOS positioning from the actual initiating widget;
  • Web native share under user activation plus each configured fallback;
  • representative small and large payload memory/disk behavior;
  • one in-flight share action under rapid taps;
  • temporary export cleanup without deleting unrelated files;
  • privacy review for content, metadata, filenames, and URLs;
  • release builds on each supported target and important receiver application.

Never claim a share was delivered from ShareResultStatus.success. Report any platform, receiver, fallback, or payload-size path that was not executed.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.