A Flutter Plugin for MacOS User Attention API

macos_user_attention

A Flutter Plugin for MacOS User Attention API

Getting Started

Step 1: Add the package to pubspec.yaml

dependencies:
    macos_user_attention:

Step 2: Initialize MacosUserAttention()

import 'package:macos_user_attention/macos_user_attention.dart';

final _plugin = MacosUserAttention();

Request User Attention

There are two types of requests you can ask for

enum RequestUserAttentionType {
  critical,
  informational,
}

Critical Request

final requestId = await _plugin.requestUserAttention(
        RequestUserAttentionType.critical,
    );

Informational Request

final requestId = await _plugin.requestUserAttention(
        RequestUserAttentionType.informational,
    );

Cancel Request

await _plugin.cancelAttentionRequest(requestId);

NOTE:

  • You can only request user attention if your app is not in focus.

GitHub

View Github