I've written a Flutter Desktop MacOS application that uses a command line argument to process a file:
void main(List<String> args) async {
if (args.isNotEmpty) {
runApp(MyApp(args.first))
} else ...;
}
which works as expected when I run it from the shell:
# this command is ok:
/Applications/TommyView.app/Contents/MacOS/TommyView Pictures/hey.png
But when I assign this app to all *.png images, and want to run it from Finder, it shows:
(or sometimes another error depending on Info.plist: TommyView cannot open files in the “PNG image” format.)
Also I noticed that the execution goes to "else" case (i.e. args are empty).
I guess some magic is missing in Info.plist. Please help to figure out.

Thanks, @smorgan, for your response. Let me improve your answer by adding a piece of code for other Flutter developers:
MainFlutterWindow.swiftadd the following:AppDelegate.swiftyou need to handleopenFile:main.dart:Info.plistto make it "visible" in MacOS recommended apps:I hope it will help.