I am developing an flutter app, and it have several native parts,

in flutter jam using sqflite plugin to create the database file.

initDB() async{
String databasPath = await getDatabasesPath();
String path = join(databasPath,'eshaar.db');
var Db = await openDatabase(path,version: 4,onCreate: _onCreate);
return Db;


I want to access the database in this class, For adding records in specific table when receive notification while app is terminated.

import androidx.core.app.NotificationCompat;

import com.onesignal.NotificationExtenderService;
import com.onesignal.OSNotificationDisplayedResult;
import com.onesignal.OSNotificationReceivedResult;

import java.math.BigInteger;

public class MyNotificationService extends NotificationExtenderService {

    protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
        OverrideSettings overrideSettings = new OverrideSettings();
        overrideSettings.extender = new NotificationCompat.Extender() {
            public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
                if (!receivedResult.restoring) {
                    // Only set custom channel if notification is not being restored
                    // Note: this would override any channels set through the OneSignal dashboard
                    return builder.setChannelId("News");
                return builder.setChannelId("News");

        /* Do something with notification payload */
            String title = receivedResult.payload.title;
            String body  = receivedResult.payload.body;
            String sender_id = receivedResult.payload.additionalData.getString("sender_id");
            Log.d("body: ",body.toString());

            // Writes additionalData values to local database
//            SQLiteDatabase db = dbHelper.getWritableDatabase();
//            ContentValues values = new ContentValues();
//            values.put(FeedEntry.COLUMN_NAME_ARTICLE_TITLE, additionalData.articleTitle);
//            values.put(FeedEntry.COLUMN_NAME_ARTICLE_ID, additionalData.articleId);
//            long newRowId = db.insert(FeedEntry.TABLE_NAME, null, values);
        }catch (Exception e){
            Log.d("Notification: ",e.toString());

        return false;
} ```