Share Service
Overview
The Share service allows applications to share text, links, or files using the native platform share sheet. It inherits from flet.Service.
Methods
share_files** (async)share_files(files: list[ShareFile], *, title: str | None = None, text: str | None = None, subject: str | None = None, preview_thumbnail: ShareFile | None = None, share_position_origin: Offset | None = None, download_fallback_enabled: bool = True, mail_to_fallback_enabled: bool = True, excluded_cupertino_activities: Iterable[ShareCupertinoActivityType] | None = None) -> ShareResult
* **Description**: Shares one or more files with optional accompanying text and metadata.
* **Parameters**:
* files: A list of ShareFile objects.
* title: Optional title for the share sheet.
* text: Optional text content to share with the files.
* subject: Optional subject for the shared content.
* preview_thumbnail: Optional ShareFile to use as a thumbnail.
* share_position_origin: Optional Offset for the share sheet's origin.
* download_fallback_enabled: Boolean, enables download fallback (default: True).
* mail_to_fallback_enabled: Boolean, enables mailto fallback (default: True).
* excluded_cupertino_activities: An iterable of ShareCupertinoActivityType to exclude on iOS/macOS.
* **Returns**: A ShareResult object.share_text** (async)share_text(text: str, *, title: str | None = None, subject: str | None = None, preview_thumbnail: ShareFile | None = None, share_position_origin: Offset | None = None, download_fallback_enabled: bool = True, mail_to_fallback_enabled: bool = True, excluded_cupertino_activities: Iterable[ShareCupertinoActivityType] | None = None) -> ShareResult
* **Description**: Shares plain text with optional subject, title, and thumbnail.
* **Parameters**:
* text: The string content to share.
* title: Optional title for the share sheet.
* subject: Optional subject for the shared text.
* preview_thumbnail: Optional ShareFile to use as a thumbnail.
* share_position_origin: Optional Offset for the share sheet's origin.
* download_fallback_enabled: Boolean, enables download fallback (default: True).
* mail_to_fallback_enabled: Boolean, enables mailto fallback (default: True).
* excluded_cupertino_activities: An iterable of ShareCupertinoActivityType to exclude on iOS/macOS.
* **Returns**: A ShareResult object.share_uri** (async)share_uri(uri: str, *, share_position_origin: Offset | None = None, excluded_cupertino_activities: Iterable[ShareCupertinoActivityType] | None = None) -> ShareResult
* **Description**: Shares a link or URI.
* **Parameters**:
* uri: The string URI to share.
* share_position_origin: Optional Offset for the share sheet's origin.
* excluded_cupertino_activities: An iterable of ShareCupertinoActivityType to exclude on iOS/macOS.
* **Returns**: A ShareResult object.Types
ShareFile**: Represents a file for sharing.from_bytes(bytes_data: bytes, *, mime_type: str, name: str) -> ShareFile: Creates a ShareFile from in-memory bytes.
* from_path(file_path: str) -> ShareFile: Creates a ShareFile from a file path.
ShareResult**: Represents the outcome of a share operation.status: Status of the share operation.
* raw: Raw result data.
ShareCupertinoActivityType**: Enum for specifying excluded activities on iOS/macOS.Platform Support
Inheritance
flet.Service.
Previous
arrow_back
Shakedetector