• The check for if a package is installed can be simplified using flatpak info.

    $ flatpak info com.example.Nonexistent &>/dev/null; echo $?
    1
    $ flatpak info org.mozilla.firefox &>/dev/null; echo $?    
    0