managed_settings_ios 0.1.0 copy "managed_settings_ios: ^0.1.0" to clipboard
managed_settings_ios: ^0.1.0 copied to clipboard

PlatformiOS

A Flutter plugin for managing iOS Screen Time settings to block apps during sleep mode using Apple's ManagedSettings framework.

managed_settings_ios #

A Flutter plugin for iOS that lets you block apps using Apple's Screen Time API (ManagedSettings, FamilyControls, DeviceActivity frameworks).

There is currently no Flutter plugin that provides direct access to iOS Screen Time's ManagedSettings framework. This plugin fills that gap.

Features #

  • Request Screen Time (FamilyControls) permission
  • Block all apps on the device (sleep mode / focus mode)
  • Unblock all apps
  • Check current block status

Requirements #

  • iOS 16.0 or higher
  • Xcode 14+
  • A paid Apple Developer account (Family Controls entitlement requires it)

iOS Setup #

1. Enable Family Controls capability in Xcode #

Open your project in Xcode → select the Runner target → go to Signing & Capabilities → click + Capability → add Family Controls.

This will automatically add the entitlement to your app.

2. Add entitlement manually (if not using Xcode) #

Add the following to your ios/Runner/Runner.entitlements:

<key>com.apple.developer.family-controls</key>
<true/>

3. Add usage description to Info.plist #

Add the following to your ios/Runner/Info.plist:

<key>NSFamilyControlsUsageDescription</key>
<string>This app uses Screen Time to block distracting apps.</string>

4. Set minimum iOS deployment target to 16.0 #

In your ios/Podfile:

platform :ios, '16.0'

Or in Xcode → Runner target → GeneralMinimum Deployments → set to 16.0.


Installation #

dependencies:
  managed_settings_ios: ^0.1.0

Usage #

import 'package:managed_settings_ios/managed_settings_ios.dart';

// 1. Check permission
bool hasPermission = await ManagedSettingsIos.hasScreenTimePermission();

// 2. Request permission (shows system dialog)
if (!hasPermission) {
  bool granted = await ManagedSettingsIos.requestScreenTimePermission();
}

// 3. Block all apps
await ManagedSettingsIos.startSleepMode();

// 4. Unblock all apps
await ManagedSettingsIos.stopSleepMode();

// 5. Check if apps are currently blocked
bool isActive = await ManagedSettingsIos.isSleepModeActive();

API #

Method Description
requestScreenTimePermission() Shows the system Screen Time permission dialog. Returns true if granted.
hasScreenTimePermission() Returns true if permission is already granted.
startSleepMode() Blocks all apps using ManagedSettingsStore. Returns true on success.
stopSleepMode() Removes all app blocks. Returns true on success.
isSleepModeActive() Returns true if apps are currently blocked.

Important Notes #

  • Family Controls entitlement must be requested from Apple for App Store distribution. Go to developer.apple.com/contact/request/family-controls-distribution.
  • The ManagedSettings framework blocks apps device-wide — the user will see a Screen Time block screen when trying to open a blocked app.
  • This plugin is iOS only. Android is not supported.

License #

MIT

0
likes
150
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for managing iOS Screen Time settings to block apps during sleep mode using Apple's ManagedSettings framework.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on managed_settings_ios

Packages that implement managed_settings_ios