Skip to content

Support no-copy mobile model loading from user-granted files #243

Description

@leehack

Problem

The shared model cache API documents Android user-selected model libraries and iOS user-picked files/App Group paths, but the current native loading path is still file-path based. When apps receive an Android Storage Access Framework content URI, or a user-picked iOS security-scoped file that cannot be used as a stable local path, they may need to copy the model into app-private cache before loading.

Desired outcome

Support no-copy model loading where the platform and backend make it feasible:

  • Android: file-descriptor/content-URI backed loading for user-granted model files.
  • iOS/macOS: security-scoped/user-picked file handling where applicable.
  • Keep copy-to-app-cache as the documented fallback when direct loading is unavailable.

Acceptance criteria

  • Public API shape clearly distinguishes path-backed files from descriptor/URI-backed handles.
  • Unsupported backends fail loudly with actionable diagnostics.
  • Tests cover mocked Android URI grants or descriptor-style handles where feasible.
  • Docs explain when apps can share an external model library without duplicating the model file.

Context

Follow-up from PR #242, which adds platform-aware model cache strategy constructors and documents explicit mobile sharing flows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked-runtimeRequires upstream or native runtime support before Dart package work can complete.enhancementNew feature or requestmodel-assetsModel, projector, cache, and download asset workflows

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions