Last updated:
0 purchases
fyno flutter inapp
Fyno Flutter InApp SDK #
Fyno's Flutter InApp SDK comes with the ability to provide its users with a multitude of notification features, all bundled into one, allowing it to smartly provide the best and optimised message delivery service from within your application itself.
Prerequisites #
Before you start, make sure you have the following information ready
Workspace ID (WSID): You can find your workspace ID on your Fyno API Keys page.
Integration Token: Obtain the integration token from the Integrations page.
User ID: This should be a unique identifier for the currently logged-in user. This user ID is crucial for Fyno to send specific notifications to the right users.
Installation #
Install the package by using one of the following commands.
dart pub add fyno_flutter_inapp
OR
flutter pub add fyno_flutter_inapp
copied to clipboard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart/flutter pub get):
dependencies:
fyno_flutter_inapp: <latest_version>
copied to clipboard
Alternatively, your editor might support dart/flutter pub get. Check the docs for your editor to learn more.
HMAC Signature Generation #
The HMAC signature is essential for ensuring the security and integrity of your notifications. Here is an example of how to generate the HMAC signature in dart
import 'dart:convert';
import 'package:crypto/crypto.dart';
void main() {
String signature = Hmac(sha256, utf8.encode(workspaceId + integrationToken))
.convert(utf8.encode(userId))
.toString();
}
copied to clipboard
Usage #
Import the package in your Dart file:
import 'package:fyno_flutter_inapp/fyno_flutter_inapp.dart';
copied to clipboard
SDK Initialisation #
To use the SDK in your Flutter application, initialise the SDK as follows
final FynoInApp fynoInApp = FynoInApp();
// Web Socket connection
fynoInApp.fynoInAppSocketConnect(
workspaceId,
integrationId,
userId,
origin,
signature,
);
copied to clipboard
There are 2 ways you can configure InApp UI.
Fyno UI
Customisable UI
Fyno UI
fynoInApp.getFynoNotificationIconButton(
context,
<icon_color>,
),
copied to clipboard
Customisable UI
Within the Customizable UI feature, you have the flexibility to build your own UI. Additionally, you can personalize the icons for actions like 'Read all' and 'Delete all' with your own custom designs. If you are utilizing the Customizable UI, it is necessary to invoke the following APIs.
To mark all InApp notifications as Read
fynoInApp.markAllAsRead()
copied to clipboard
To delete all InApp notifications
fynoInApp.deleteAllMessages()
copied to clipboard
To mark a single InApp notifications as Read
fynoInApp.markAsRead(notification) // pass one of the items from this list fynoInApp.fynoInAppState.list
copied to clipboard
To delete a single InApp notification
fynoInApp.deleteMessage(notification) // pass one of the items from this list fynoInApp.fynoInAppState.list
copied to clipboard
To load more notifications (based on pagination)
fynoInApp.loadMoreNotifications(page, type) // type -> 'all' or 'unread', page should be greater than zero
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.