How yazanturk/pusher_beams works
Project type and purpose
• Type: Federated Flutter plugin (SDK/library), not a standalone application
• Purpose: Expose Pusher Beams push-notification capabilities to Flutter apps via a single “app-facing” Dart API, dispatching calls to native (Android/iOS) or JavaScript (Web) implementations
File structure
• Top-level “packages” folder contains five packages:
– pusher_beams (app-facing Dart API + example)
– pusher_beams_platform_interface (abstract interface + Pigeon definitions)
– pusher_beams_android (Android native plugin implementation)
– pusher_beams_ios (iOS native plugin implementation)
– pusher_beams_web (Web JS plugin implementation)
• Example sub-folder under pusher_beams demonstrates usage + integration tests
• Makefile in platform_interface for Pigeon code generation
• pubspec.yaml files define inter-package dependencies
README for additional insights
• Section “Architecture” explicitly names the five packages and describes federated plugin architecture
• Pigeon is used to generate method-channel bindings
• Dependencies: Flutter (Dart), Android SDK (Firebase), iOS SDK (APNs), Web SDK (Pusher Beams JS)
Main components & interactions
a. Components:
– Flutter App (example or end-user app)
– pusher_beams Dart package (app-facing public API)
– pusher_beams_platform_interface (abstract interface & Pigeon messages)
– Platform plugins:
• pusher_beams_android (Android/Kotlin + Java)
• pusher_beams_ios (Objective-C + Swift)
• pusher_beams_web (Dart→JS wrapper)
– External services:
• Pusher Beams service (REST/WebSocket endpoint)
• Firebase (Android prereq: google-services.json)
• APNs (iOS prerequisite)
b. Relationships & data flow:
• Flutter App → calls methods on PusherBeams.instance (from pusher_beams package)
• pusher_beams package → delegates to PusherBeamsPlatform.instance (from platform_interface)
• platform_interface uses Pigeon-generated classes to route calls over MethodChannel (Android/iOS) or JS interop (Web)
• Platform plugin receives method call → invokes native SDK or JS SDK → communicates with Pusher Beams service
• Incoming messages/events propagate back: native/JS SDK → MethodChannel/JS callback → Dart layer → app
c. Architectural patterns & principles:
• Federated plugin architecture: clear separation between app API, platform-agnostic interface, and per-platform code
• Interface segregation: platform_interface package defines only abstract APIs
• Pigeon codegen: type-safe, generated MethodChannel glue
d. Key technologies/frameworks:
• Flutter / Dart
• MethodChannel (Android & iOS IPC)
• Pigeon (code generation for platform messaging)
• Kotlin/Java (Android), Swift/Obj-C (iOS), JS (Web)
• Firebase (Android), APNs (iOS), Pusher Beams JS SDK (Web)