GLib-GObject error when running my snap - Flutter Project

Please help.

My project runs fine on my local Linux Ubuntu 24 system. The snap builds without any issues but crashes instantly when run.

Error:

GLib-GObject-CRITICAL **: 08:43:05.324: g_type_plugin_use: assertion ‘G_IS_TYPE_PLUGIN (plugin)’ failed Trace/breakpoint trap (core dumped)

I install the snap with:

sudo snap install example.snap --dangerous --devmode

I did run the app in a shell and expected the installed packages. All the Environment variables are set and the packages and modules are installed. So I have no idea what to check further.

GTK_PATH is set and points to installed gtk packages which I can confirm are installed by inspecting the directories. I can also see libglib-2.0.so is installed. I believe the GNOME extension sets all these things

Snapcraft settings:

I do have to override the build because I use a specific Flutter version and install by referring to a file that sets environment variables.

I have plenty of staged and build packages I included - specific to the project, however I don’t think they are part of the issue. I have made many attempts to include different packages.

base: core24
confinement: devmode
apps:
  example:
    extensions: [gnome]
    command: example
    plugs:
      - network
      - audio-playback

parts:
  example:
    source: .
    plugin: flutter
    flutter-target: lib/main.dart
    override-build: |
      rm -rf $SNAPCRAFT_PART_SRC/build
      craftctl default

      git clone --depth 1 --branch 3.24.3 https://github.com/flutter/flutter.git $SNAPCRAFT_PART_INSTALL/flutter
      export PATH="$SNAPCRAFT_PART_INSTALL/flutter/bin:$PATH"
      flutter config --enable-linux-desktop
      flutter doctor
      flutter clean
      flutter pub get
      flutter build linux --dart-define-from-file=devops/example/example.env