Back to Flet

PermissionHandler

website/docs/services/permissionhandler/index.md

0.85.0.dev21.9 KB
Original Source

import TabItem from '@theme/TabItem'; import Tabs from '@theme/Tabs'; import {ClassAll, CodeExample} from '@site/src/components/crocodocs';

Permission Handler

Helps manage runtime permissions in your Flet apps.

It is powered by the Flutter permission_handler package.

Platform Support

PlatformWindowsmacOSLinuxiOSAndroidWeb
Supported

Usage

Add flet-permission-handler to your project dependencies:

<Tabs groupId="uv--pip"> <TabItem value="uv" label="uv"> ```bash uv add flet-permission-handler ``` </TabItem> <TabItem value="pip" label="pip"> ```bash pip install flet-permission-handler # (1)! ```
  1. After this, you will have to manually add this package to your requirements.txt or pyproject.toml. </TabItem>
</Tabs> :::note[Note] On mobile platforms you must also declare permissions in the native project files. See [Flet publish docs](../../publish/index.md#permissions). :::

Requirements

While the permissions are being requested during runtime, you'll still need to tell the OS which permissions your app might potentially use.

Android

See:

iOS

See:

Example

<CodeExample path={frontMatter.examples + '/example_1/main.py'} language="python" />

Description

<ClassAll name={frontMatter.class_name} />