Making the app single-instanced
Single-instanced apps only allow one instance of the app running at a time. Flutter Windows apps are multi-instanced by default. If a first instance exists when trying to start a new instance, end the new instance and activate the first instance.
Find the window
FindWindow, activate the window if it exists and end the current program.
single_instance_exampleto the name of your app.
Change the file
windows/runner/main.cpp as follows: