flutter – iOS background handler not getting invoked for Firebase push notifications in launch mode


I’ve an issue the place the background handler for Firebase push notifications isn’t invoked once I ship a message within the TestFlight launch of my app. The foreground handler appears to work nice, however the background handler does not.

Here is the message payload I am sending:

    "registration_ids": "$ids",
    "notification": {
        "physique": "$physique",
        "title": "$title",
        "subtitle": "$subtitle",
        "badge": 0,
        "sound": "default"
    "information": {
        "quantity": "120"
    "apns": {
        "payload": {
            "aps": {
                "mutable-content": 1,
                "content-available": 1

My Dart code is as follows:

void foremost() async {
  // Initialization and different code
  FirebaseMessaging.onMessage.pay attention((RemoteMessage message) async {
    // ... foreground dealing with code which works nice
  runApp(const MyApp());

Future<void> backgroundHandler(RemoteMessage message) async {
  await ApiCall.check();
  await HomeWidget.saveWidgetData<String>('quantity', message.information["amount"]);
  await HomeWidget.updateWidget(title: 'HomeWidgetProvider', iOSName: 'HomeWidget');

It is value noting that:

The ApiCall.check() perform logs to my server, and I do not see any logs when the app is within the background, which implies the handler is not invoked.
The HomeWidget capabilities deal with updating a widget on the iOS house display.
The foreground handler (inside onMessage.pay attention) is working completely. The problem is simply with the background handler.

The flutter physician output:

Physician abstract (to see all particulars, run flutter physician -v):
[✓] Flutter (Channel steady, 3.13.5, on macOS 13.6 22G120 darwin-arm64, locale en-CA)
[✓] Android toolchain - develop for Android units (Android SDK model 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the net
[✓] Android Studio (model 2022.2)
[✓] IntelliJ IDEA Final Version (model 2023.2.2)
[✓] VS Code (model 1.82.0)
[✓] Community sources

Any insights on why the background handler may not be getting invoked could be tremendously appreciated.