These Enhancements Make Flutter Beast At Making Apps For Windows, macOS, and Linux. | by Ranjan Kumar | Jan, 2025

Flutter Latest Enhancements.

Photo by Noah Dustin von Weissenfluh on Unsplash

What it means:
You can control the app window size, position, and whether it can be resized.

Example: Setting Window Size

To control the window size on a desktop platform, you can use the window_size package.

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

void main() {
WidgetsFlutterBinding.ensureInitialized();
setWindowTitle("Flutter Desktop App");
setWindowMinSize(const Size(400, 300)); // Minimum window size
setWindowMaxSize(const Size(800, 600)); // Maximum window size
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Window Management Example')),
body: Center(
child: Text('This app has controlled window size!'),
),
),
);
}
}

Key Point:

You can ensure the app window is not too small or too big and manage its behavior.