← Back to posts Cover image for Shipping Flutter Desktop Apps to the Mac App Store: Essential Lessons Learned

Shipping Flutter Desktop Apps to the Mac App Store: Essential Lessons Learned

· 4 min read
Weekly Digest

The Flutter news you actually need

No spam, ever. Unsubscribe in one click.

Chris
By Chris

Shipping a Flutter desktop app to the Mac App Store feels like a different discipline. You can have a clean codebase, smooth performance, and a polished UI, then still hit review friction because macOS has its own contract with the user. The app must behave like a Mac app, not a shrunken mobile app.

The first area is menu shortcuts. On macOS, native menu items become key equivalents. If you expose a global Cmd+A action for “Archive Task,” the system can consume that key combination before your Flutter text field sees it. That breaks basic editing expectations: select all, copy, paste, and undo should remain predictable.

A safer pattern is to reserve common editing shortcuts for the system and use modified combinations for app actions.

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class TaskApp extends StatelessWidget {
  const TaskApp({super.key});

  void _archiveTask() {
    // Archive the selected task.
  }

  @override
  Widget build(BuildContext context) {
    final content = Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: TextField(
          decoration: InputDecoration(labelText: 'Search tasks'),
        ),
      ),
    );

    if (!Platform.isMacOS) return content;

    return PlatformMenuBar(
      menus: [
        PlatformMenu(
          label: 'Tasks',
          items: [
            PlatformMenuItem(
              label: 'Archive Task',
              shortcut: MenuShortcut(
                LogicalKeyboardKey.keyA,
                command: true,
                shift: true,
              ),
              onSelected: _archiveTask,
            ),
          ],
        ),
      ],
      child: content,
    );
  }
}

This snippet only installs the native menu on macOS and uses Cmd+Shift+A for the custom action, so Cmd+A remains available for the TextField. Standard editing behavior is not accidentally swallowed. If you need custom selection actions, implement them through the focused widget or use platform edit commands rather than a global shortcut that competes with Flutter’s own key handling.

The second area is application lifecycle. In mobile Flutter, you often think in terms of foreground and background. On macOS, closing the main window is not always the same as quitting the app. For a small utility, users usually expect the app to quit when the last window closes. For a document-style app, it may stay in the Dock and respond to reopening. Pick one behavior intentionally.

For a single-window utility, you can terminate cleanly when the window closes:

import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class TaskLifecycleApp extends StatefulWidget {
  const TaskLifecycleApp({super.key});

  @override
  State<TaskLifecycleApp> createState() => _TaskLifecycleAppState();
}

class _TaskLifecycleAppState extends State<TaskLifecycleApp> with WidgetsBindingObserver {
  VoidCallback? _previousOnWindowClose;

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);

    if (Platform.isMacOS) {
      _previousOnWindowClose = PlatformDispatcher.instance.onWindowClose;
      PlatformDispatcher.instance.onWindowClose = () {
        _saveState();
        _previousOnWindowClose?.call();
        SystemNavigator.pop();
      };
    }
  }

  @override
  void dispose() {
    if (Platform.isMacOS) {
      PlatformDispatcher.instance.onWindowClose = _previousOnWindowClose;
    }
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    if (state == AppLifecycleState.inactive ||
        state == AppLifecycleState.paused) {
      _saveState();
    }
  }

  void _saveState() {
    // Persist the current task list.
  }
}

This is better than calling exit(0) directly. SystemNavigator.pop() gives the engine a chance to unwind gracefully. Restoring the previous callback in dispose() also keeps the app polite when it is embedded in tests or reused across hot restarts.

The third area is UI/UX. Mac App Store reviewers are not only looking for crashes. They notice obvious platform mismatches: missing About/Quit/Preferences menus, custom window chrome that hides traffic lights, tiny touch-sized controls that ignore pointer precision, and navigation that assumes a back button. Use Platform.isMacOS where you need a desktop layout, but do not build a separate app for every platform unless the experience truly differs.

The fourth area is sandboxing. The Mac App Store requires the app to run in a sandbox, and Flutter’s macOS Runner has entitlement files for both debug and release profiles. If your app saves tasks, opens user-selected files, or accesses folders, make sure the entitlements match what the app actually does.

<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>

Do not request broad capabilities “just in case.” Reviewers and users notice. If you need network access, declare it. If you do not need it, remove it.

Finally, test with the same expectations you would have for any Mac utility. Check keyboard focus rings, context menus, drag and drop, window resizing, and what happens when the app is hidden or reopened. The review process becomes much smoother when the app feels like it belongs on macOS.

This blog is produced with the assistance of AI by a human editor. Learn more

Related Posts

Cover image for Choosing the Right Storage for Flutter: Beyond SharedPreferences for Persistent Data

Choosing the Right Storage for Flutter: Beyond SharedPreferences for Persistent Data

Developers frequently struggle with persistent storage in Flutter, especially when dealing with OS-level backups and app reinstalls. This post will clarify the nuances of different storage solutions like `SharedPreferences`, `path_provider`, and `flutter_secure_storage`, focusing on how to correctly manage data lifetimes (per-install vs. per-user) and avoid issues like device IDs migrating to new phones or data being unexpectedly backed up.

Cover image for Optimizing Flutter UI Performance: Solving `ImageFiltered` Lag and Smooth Blurring

Optimizing Flutter UI Performance: Solving `ImageFiltered` Lag and Smooth Blurring

Flutter's `ImageFiltered` can cause significant lag when blurring large or frequently changing content like text. This post will explain the performance bottlenecks, provide solutions like caching blurred outputs with `RepaintBoundary` or `SnapshotWidget`, and offer practical tips to ensure smooth UI effects without sacrificing frame rates.