core/services/permission/ — Permission Service

Wrap runtime permission checks and requests for Flutter apps.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/Vantoan252003/Mozi --skill core-services-permission-permission-service
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core/services/permission/ — Permission Service
Source: https://github.com/Vantoan252003/Mozi/tree/main/lib/core/services/permission
Command: npx skills add https://github.com/Vantoan252003/Mozi --skill core-services-permission-permission-service

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Consolidates and standardizes runtime permission checking and requesting in a single service to avoid duplicated permission logic, inconsistent user prompts, and scattered permission handling across a Flutter app.

Core Features & Use Cases

  • Unified API: Exposes methods to check and request common mobile permissions such as location, notifications, camera, and photos.
  • Consistent status mapping: Converts PermissionStatus values into a PermissionState enum (granted, denied, permanentlyDenied, restricted) so callers can handle UI flows deterministically.
  • Practical use cases: Pre-check location permission before invoking LocationService, verify camera permission for avatar upload, and detect permanently denied states to show an "Open Settings" flow.

Quick Start

Call PermissionService.checkLocation() to pre-check location permission and then call PermissionService.requestLocation() if the permission is not granted.

Frequently Asked Questions about core/services/permission/ — Permission Service

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I centralize Flutter runtime permission checks for location and camera?

To centralize Flutter runtime permission checks, wrap permission_handler logic in a unified service to pre-check and request location, camera, photos, and notifications, mapping PermissionStatus to a PermissionState enum for consistent UI flows.

Why does my Flutter app show inconsistent permission prompts during onboarding?

Inconsistent permission prompts occur when logic is scattered across a Flutter app. Consolidating checks and requests into a single permission service standardizes pre-checking and maps statuses deterministically to prevent duplicate or conflicting prompts.

How do I handle permanentlyDenied permissions in Flutter to open app settings?

To handle permanentlyDenied permissions in Flutter, map the PermissionStatus to a permanentlyDenied state and surface an open-app-settings flow, prompting the user to manually grant the restricted location or camera access from the device settings.

Can I use permission_handler to pre-check location permission before requesting it?

Yes, you can use permission_handler to pre-check location permission. Call a unified check method to verify the current status before invoking a request method, ensuring you only prompt the user when the permission is not already granted.

What is the best way to manage multiple mobile runtime permissions in a Flutter app?

The best way to manage multiple mobile runtime permissions is a unified service wrapper that standardizes checking and requesting for location, camera, and photos, converting PermissionStatus into a PermissionState enum for deterministic handling.

Do I need a custom enum for PermissionStatus in Flutter permission handling?

You need a custom PermissionState enum to map PermissionStatus values like granted, denied, and permanentlyDenied, allowing callers to handle mobile permission UI flows deterministically across the application.