Mac windows manager on Flutter

3 min

May 7, 2024

Flutter gives us opportunity to build macOS app's. Competition on Mac AppStore is low, most of big companies do not ship their products through AppStore cause of big commissions. It is good opportunity for small publishers to grab a traffic.

After building ios-android version of application, we can add macOS support also, depending of niche. Some applications are really only for smartphone, but mostly it would be great to have it on Desktop also. You can enter Mac AppStore and see that there is almost no good competition, if you are not building something like Task Management Tool (It is really saturated).

Real pain is that screen of desktop apps can be adjustable, user can resize it, and that why we want to set minimum size to which we are ready.

Add dependency to pubscpec.yaml

dependencies:
  window_manager: ^0.3.8

Import dependency

import 'package:window_manager/window_manager.dart';

Add this code to your main.dart before runApp()

  if (Platform.isMacOS) {
    await windowManager.ensureInitialized();
    WindowManager.instance.setMinimumSize(const Size(1200, 832));
  }

Adjust size to your needs, and we are done.

Thank you! On next articles we will look how to create responsive UI for mobile, tablet and desktop. See you soon

Get FlutterPlate

I left here 50% discount promocode "UYOTI0MQ" tshhh…🤫

Ship apps faster.