How x-slayer/notification_listener_service works
Project type & purpose (what you’re diagramming)
This repository is a Flutter plugin (Dart package + Android platform implementation) that lets a Flutter app:
• Check/request Notification Listener permission
• Receive Android notification posted/removed events as a Dart Stream
• Reply to notifications (via Android RemoteInput / actions)
So the “system” you’re diagramming is not a typical backend; it’s a mobile plugin architecture bridging Flutter (Dart) ↔ Android OS NotificationListenerService APIs.
Repo structure to architectural components
Use the file tree to identify boundaries:
Dart / Flutter package (public API surface)
• lib/notification_listener_service.dart
Likely the main API: permission methods + notificationsStream.
• lib/notification_event.dart
Data model (e.g., ServiceNotificationEvent) and helper methods like sendReply.
Android platform implementation (the real “engine”)
• android/src/main/java/notification/listener/service/NotificationListener.java
The Android NotificationListenerService subclass that receives OS callbacks.
• android/src/main/java/notification/listener/service/NotificationListenerServicePlugin.java
The Flutter plugin entrypoint: sets up MethodChannel/EventChannel and binds to service/event stream.
• android/src/main/java/notification/listener/service/NotificationReceiver.java
BroadcastReceiver or internal receiver for actions/replies or lifecycle events.
• android/src/main/java/notification/listener/service/NotificationUtils.java
• android/src/main/java/notification/listener/service/NotificationConstants.java
Channel names, intent actions, keys, etc.
• android/src/main/java/notification/listener/service/models/*
Reply/action support:
• Action.java (an action model)
• RemoteInputParcel.java (parcelable remote input data)
• ActionCache.java (stores actions per notification for later reply)
Tests
• test/notification_listener_service_test.dart
Likely Dart-side API tests (not Android instrumentation).
What the README tells you to emphasize
The README explicitly defines:
• Manifest service binding requirement (BIND_NOTIFICATION_LISTENER_SERVICE)
• Permission workflow (isPermissionGranted(), requestPermission())
• Event streaming contract (notifications posted/removed)
• Reply flow (event.sendReply())
Dart Plugin Layer
• NotificationListenerService (API facade)
• ServiceNotificationEvent (event model + reply method)
Flutter Platform Channels
• MethodChannel for permission checks / requests / reply commands
• EventChannel for notification event stream
Android Plugin Layer
• NotificationListenerServicePlugin (channel handlers, wiring)
Android Service
• NotificationListener (extends NotificationListenerService)
Android OS / Framework
• NotificationManager / System UI pipeline (conceptual)
Supporting Android components
• NotificationReceiver (broadcast/action handling)
• ActionCache, RemoteInputParcel, Action (reply/action data plane)
• NotificationUtils (parsing/serialization)
External Actor
• “Other Apps” that post notifications (WhatsApp, Gmail, etc.)
• Other Apps → Android OS → NotificationListener (posted/removed callbacks)
• NotificationListener → Android Plugin (NotificationListenerServicePlugin) → EventChannel → Dart Stream → Flutter App UI
• Flutter App → Dart API → MethodChannel → Android Plugin → (opens Settings for permission / checks status)
• Flutter App → event.sendReply() → MethodChannel → Android Plugin → ActionCache/RemoteInputParcel → Android OS notification action dispatch
“Notification received” sequence
Lifelines:
• Other App
• Android OS
• NotificationListener (service)
• NotificationUtils
• NotificationListenerServicePlugin
• EventChannel
• Dart NotificationListenerService.notificationsStream
• Flutter App listener
Show:
“Reply to notification” sequence
Lifelines:
• Flutter App
• Dart ServiceNotificationEvent.sendReply
• MethodChannel
• NotificationListenerServicePlugin
• ActionCache / RemoteInputParcel
• Android OS (RemoteInput / notification action)
• Target app (recipient of reply)
Show:
Architectural patterns to call out explicitly
• Flutter Plugin architecture (Dart API + platform implementation)
• Event-driven streaming (Android callbacks → EventChannel → Dart Stream)
• Command/query split over MethodChannel:
• Query: isPermissionGranted
• Command: requestPermission, sendReply
• OS-managed service lifecycle (NotificationListenerService is controlled by Android)
• Caching layer for actions (ActionCache) enabling deferred reply calls
On components, annotate:
• Flutter / Dart (lib/*)
• Flutter Platform Channels (MethodChannel/EventChannel)
• Android (Java)
• Android NotificationListenerService
• Android RemoteInput / notification actions (conceptual, even if wrapped by your code)
• Android Manifest binding + permission (BIND_NOTIFICATION_LISTENER_SERVICE)
• (Optional) Settings screen / permission UI as an OS subsystem
Minimum “best” output to aim for
Deliverables that will be both accurate and useful:
• “Flutter app process” vs “Android system service callbacks”
• Manifest-declared service binding requirement