PermissionHandler service
Create or retrieve this service with page.permission_handler(**properties). Ruflet reuses the registered service unless you supply a different id.
Example
status = text(value: "Camera permission not requested")
page.add(status)
permissions = page.permission_handler
permissions.request("camera", on_result: ->(permission, error) {
page.update(status, value: error ? error.to_s : "Camera: #{permission}")
})
Page accessor
page.permission_handler(**props)
Properties
data— Arbitrary value you can attach to the control and read back in handlers.key— Stable identity used to preserve state across rebuilds.
Service methods
get_status(permission, timeout: ..., on_result: ...)open_app_settings(timeout: ..., on_result: ...)request(permission, timeout: ..., on_result: ...)
Result and error handling
Client calls are asynchronous. When a method accepts on_result:, handle both callback values: |result, error|. Availability and returned data can vary by platform.
Common service API
The service also supports the common Ruflet control API: attach_handler(event_name, handler), children, emit(event_name, event), has_handler?(event_name), id, merge_props(values = ...), on(event_name, &block), props, runtime_page, runtime_page=, to_patch, type, wire_id, wire_id=.
Use the named methods above for application code; common control methods mainly support event registration, updates, and runtime integration.
Wire reference
- Service helper:
permission_handler - Wire type:
permissionhandler - Aliases:
permissionhandler
Client extension setup
This service is implemented by the flet_permission_handler Flet extension. Enable it in ruflet.yaml, then rebuild the client:
extensions:
- permission_handler
Application code uses page.permission_handler; do not add the package directly to your app's Flutter dependencies.