addActionToDatabase function
- SharedDatabase database,
- NotificationResponse response
Saves a NotificationResponse to the local database
Implementation
Future<void> addActionToDatabase(
SharedDatabase database,
NotificationResponse response,
) async {
final notificationId = response.id;
final payload = response.payload;
if (notificationId == null || payload == null) {
if (kDebugMode) {
print('Action $response could not be saved.');
}
return;
}
await database.into(database.notificationActions).insert(
NotificationActionsCompanion.insert(
notificationId: notificationId,
payload: payload,
),
);
}