flutter_control_center library
iOS 18+ controls (Control Center, Lock Screen, Action button) for Flutter.
Controls are WidgetKit ControlWidgets that live in a Widget Extension
written in Swift. This library is the Flutter app's side: it stores the
controls' state in a shared App Group, asks the system to reload controls,
and delivers control actions (button presses, toggle flips) as a stream.
await FlutterControlCenter.configure(appGroup: 'group.com.example.app');
await FlutterControlCenter.setToggleState('focus_mode', true);
FlutterControlCenter.actions.listen((action) {
if (action.kind == 'start_timer') startTimer();
});
The Swift side is generated with dart run flutter_control_center:setup;
see the README for the Xcode steps.
Classes
- ControlAction
-
An interaction with a control, delivered on
FlutterControlCenter.actions. - ControlState
- Stored state of a toggle control, read from the shared App Group.
- FlutterControlCenter
- Entry point for iOS 18+ controls (Control Center, Lock Screen, Action button).
Enums
- ControlActionType
- What kind of control produced a ControlAction.
- ControlStateSource
- Who last wrote a control's state.
Exceptions / Errors
- ControlCenterUnsupportedException
- Thrown when controls are not available on the current platform: any platform other than iOS, or iOS older than 18.
- FlutterControlCenterException
-
Thrown when the native side rejects a call, for example because
code is
not_configured(callconfigurefirst) orapp_group_unavailable(the App Group entitlement is missing).