Notification when application is closed

Hello there, how to allow the user to receive notifications even when the app is closed.
Thank you in advance.

Please checkout this link https://pub.dev/packages/firebase_messaging

By default background messaging is not enabled. To handle messages in the background:

  1. Add the com.google.firebase:firebase-messaging dependency in your app-level build.gradle file that is typically located at <app-name>/android/app/build.gradle .
dependencies {
  // ...

  implementation 'com.google.firebase:firebase-messaging:<latest_version>'
}

Note: you can find out what the latest version of the plugin is here (“Cloud Messaging”).
2. Add an Application.java class to your app in the same directory as your MainActivity.java . This is typically found in <app-name>/android/app/src/main/java/<app-organization-path>/ .

package io.flutter.plugins.firebasemessagingexample;

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;

public class Application extends FlutterApplication implements PluginRegistrantCallback {
  @Override
  public void onCreate() {
    super.onCreate();
    FlutterFirebaseMessagingService.setPluginRegistrant(this);
  }

  @Override
  public void registerWith(PluginRegistry registry) {
    GeneratedPluginRegistrant.registerWith(registry);
  }
}

Thank you, i use onesignal to send notification. Ok I will insert it.