main function

void main()

Main entry point for the NotePod application.

Implementation

void main() async {
  // We require [async] because we asynchronously [await] the window manager
  // below. Often, `main()` will include just the call [runApp].

  // Optionally we can globally remove [debugPrint] messages.
  //
  // debugPrint = (String? message, {int? wrapWidth}) {
  //   null;
  // };

  // Ensure Flutter bindings are initialized for async operations, in particular
  // to set the Linux desktop window [title].

  WidgetsFlutterBinding.ensureInitialized();
  if (isDesktop) {
    // await windowManager.ensureInitialized();

    const windowOptions = WindowOptions(
      // Set various desktop window options here, specifically the title.

      // Setting [alwaysOnTop] here will ensure the app starts on top of other
      // apps on the desktop so that it is visible (otherwise, with GNOME on
      // Ubuntu the app is often lost below other windows on startup).
      // We later turn it off as we don't want to force it always on top.
      //
      // 20250815 gjw Staying [alwaysOnTop] on startup seems okay now?

      // alwaysOnTop: true,

      title: 'NotePod - A note taking app with private PODs',
    );

    // Once the window manager is ready we reconfigure it a little.

    await windowManager.waitUntilReadyToShow(windowOptions, () async {
//      await windowManager.show();
//      await windowManager.focus();
//      await windowManager.setAlwaysOnTop(false);
    });
  }

  // The runApp() function takes the given Widget and makes it the root of the
  // widget tree.

  runApp(const NotePod());
}