notification_flutter

A flutter plug-in for the native Teko Notification library (Android and iOS).

Getting Started

Table of content

Running example

Android

  • Open example/android project with Android studio
  • Add TekoGoogleRegistryToken to local.properties of this project
// example/android/local.properties

TekoGoogleRegistry.password=<your-token>
  • Run project

iOS

  • Setup github access token for accessing Teko iOS frameworks.

  • Run commands below in the terminal

cd example
flutter build ios --no-codesign
  • Launch Xcode and open example/ios/Runner.xcworkspace file

Pigeon model

This project use Pigeon to generate code for communication between Flutter and the native side.

The Pigeon file is located in the pigeon folder.

To generate code with Pigeon, please run ./scrips/pigeon_gen.sh file.

Library usage

Initialize Terra Notification

First initialize TerraApp with APP_NAME and terraClientId

Initialize TerraNotification by APP_NAME

await TerraApp.initTerraApp(
  appName: "APP_NAME",
  terraConfig: InitAppConfig(
    terraClientId: "your terraClientId",
    terraEnvironment: TerraEnv.Develop,
  ),
);
final terraNotification = await TerraNotification.getInstance("APP_NAME");

All function of NotificationFlutter

abstract class NotificationFlutter {
  Future<Result<void>> registerToken(String deviceToken);

  Future<Result<void>> unregisterToken(String deviceToken);

  Future<Result<NotificationList>> getNotificationList(GetNotificationListQuery query);

  Future<Result<int>> countUnreadNotifications(String? deviceToken);

  Future<Result<void>> markReadNotification(int notificationId);

  Future<Result<void>> markReadAllNotification(String deviceToken);
}