---
title: Configure a notification listener using the Flutter SDK
slug: feature-experimentation/docs/set-up-notification-listener-flutter
docTags: 
createdAt: 2026-08-05T20:39:50.000Z
---

Notification listeners trigger a callback function that you define when the SDK triggers based on certain actions.

The most common use case is to send a stream of all feature flag decisions to an analytics provider or to an internal data warehouse to join it with other data that you have about your users.

## Notification listener types

For information about notification listener types and use cases, see [Notification listeners](docId:0d__cjuKECyJGqgTV0_5e).

For code samples, see the following sections.

## Add or remove all notification listeners

The following example code shows how to add a listener and remove a listener.

```dart
// Add Notification Listener (LogEvent)
var logEventListenerId =
  await flutterSDK.addLogEventNotificationListener((logEvent) {
    print(logEvent.url);
    print(logEvent.params);
  });
// Remove Notification Listener
await flutterSDK.removeNotificationListener(logEventListenerId);

// Clear all notification listeners of a certain type
await flutterSDK.clearNotificationsListeners(ListenerType.logEvent);

// Clear all notifications
await flutterSDK.clearAllNotificationListeners();
```

## Configure each type of notification listener

The following example code shows how to configure each type of notification listener.

```dart
// SET UP DECISION NOTIFICATION LISTENER
var decisionEventListenerId = await flutterSDK.addDecisionNotificationListener((notification) {
// Access type on decisionObject to get type of decision
var decisionType = notification.type;
  if (decisionType == "flag") {
    var flagDecisionInfo = notification.decisionInfo;
    var flagKey = flagDecisionInfo["flagKey"];
    var enabled = flagDecisionInfo["enabled"];
    var decisionEventDispatched = flagDecisionInfo["decisionEventDispatched"];
  }
    // Send data to analytics provider here
});

// SET UP LOG EVENT NOTIFICATION LISTENER
var logEventListenerId = await flutterSDK.addLogEventNotificationListener((logEvent) {
    // process the logEvent object here (send to analytics provider, audit/inspect data)
});

// SET UP OPTIMIZELY CONFIG NOTIFICATION LISTENER
// You will get notifications whenever the datafile is updated except for SDK initialization
var updateConfigListenerId = await flutterSDK.addConfigUpdateNotificationListener((configNotification) { 
    var optimizelyConfig = flutterSDK.getOptimizelyConfig();
});

// SET UP TRACK LISTENER
var trackNotificationListenerId = await flutterSDK.addTrackNotificationListener((trackNotification) { 
    // process the event here (send to analytics provider, audit/inspect data)
});
```
