flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.18k stars 26.64k forks source link

[Feature request] Choose flutter app as windows default app #147466

Open Jamalianpour opened 2 weeks ago

Jamalianpour commented 2 weeks ago

Use case

Currently, Flutter apps built for Windows desktop may not be readily discoverable when users attempt to set default programs for opening specific file types (e.g., images). This can hinder the user experience and limit the adoption of Flutter apps as default tools.

I have a flutter app that can open and edit images, now I want to make it the default windows app. But it was not shown in the list of programs:

default app

Proposal

stuartmorgan commented 2 weeks ago

Currently, Flutter apps built for Windows desktop may not be readily discoverable when users attempt to set default programs for opening specific file types (e.g., images).

Could you elaborate on what you mean by this? Are you saying you added the necessary system registry keys for your application to be registered as a handler for a file type, as would be necessary for any application on Windows (Flutter or not), and it still didn't show up as an option?

loic-sharma commented 2 weeks ago

Like Stuart said, this should be possible with Flutter. Here are Windows's docs on how to register which file types your application can open: https://learn.microsoft.com/en-us/windows/win32/shell/how-to-register-a-file-type-for-a-new-application

You should be able to use package:win32 to interact with the Windows registry. For example: https://github.com/dart-windows/win32/blob/158d0d67112015b5bc9ddc1a35f72b60c0d584fd/example/registry.dart#L80-L99

Please let us know if there's something in Flutter that blocks you from accomplishing this.

Jamalianpour commented 2 weeks ago

The package:win32 and registry modification approach you provided is definitely valuable for associating our Flutter app with specific file types when users right-click "Open with...". This improves discoverability in that context.

However, my primary concern is making Flutter apps appear in the list of default apps within Windows Settings > Apps > Default apps. This is where users set their preferred programs for handling various file types (like Photo) by default. Currently, Flutter apps seem to be missing from that list.

loic-sharma commented 2 weeks ago

Currently, Flutter apps seem to be missing from that list.

Does Flutter need to do something different to be on that list?

I suspect that Windows uses your app's supported file types to determine whether the app can be a default app for photos. In other words, I suspect this is a problem with your app and not Flutter.

My recommendation would be:

  1. Find a third-party app that shows up on the photos app list
  2. Update your app's registry keys to mirror the third-party app's supported file types.
  3. Check if your app shows up on the list of photos apps

If this doesn't fix your issue, then please:

  1. Create a native app using win32, or WinForms, or WPF, or WinRT
  2. Make your native app show up on the list of photos app. You might need to reach out to Windows communities for help here.
  3. Once your native app shows up on the list of photos apps, please share:
    1. Your sample native app that shows up on the list of photos app
    2. A sample Flutter app that attempts to show up on the list of photos app