Flutter (Headless)
SuprSend SDK for Flutter applications for integrating inbox functionality using flutter hooks
SuprSend uses flutter hooks to provide inbox functionality in flutter applications.
Installation
Project’s pubspec.yaml changes
Add the following line of code inside dependencies in the pubspec.yaml
file under the dependencies section
Run flutter pub get in the terminal
Initialization
Enclose your Material App inside SuprSendProvider and pass the workspace key, workspace secret, distinct_id, and subscriber_id.
Adding SuprSend Inbox component
useBell hook
This hook provides unSeenCount, markAllSeen which is related to the Bell icon in the inbox
unSeenCount: Use this variable to show the unseen notification count anywhere in your application. markAllSeen: Used to mark seen for all notifications. Call this method on clicking the bell icon so that it will reset the notification count to 0.
useNotifications hook
This hook provides a notifications list, unSeenCount, markClicked, and markAllSeen.
notifications: List of all notifications. This array can be looped and notifications can be displayed.
unSeenCount: Use this variable to show the unseen notification count anywhere in your application.
markClicked: Method used to mark a notification as clicked. Pass notification id which is clicked as the first param.
Example Implementation
Example implementation can be found here.