Chabok Push Client for Flutter

pub package

Flutter wrapper for chabok library. This client library supports Flutter to use chabok push library. A Wrapper around native library to use chabok functionalities in Flutter environment.


For installation refer to Flutter docs and platform specific parts (Android and iOS).

Release Note

You can find release note here.


Please visit Issues.


Getting Started - Android

  1. Add Google and Chabok plugins to build.gradle project level file.
buildscript {
    repositories {
        maven {
            url "" 
    dependencies {
    	classpath ""
        classpath "io.chabok.plugin:chabok-services:1.0.0"
        classpath ""
  1. Apply Google and Chabok plugins to build.gradle application level file.
dependencies {
    // your project dependencies

apply plugin: 'io.chabok.plugin.chabok-services'
apply plugin: ''
  1. Initialize Chabok SDK in your
import com.adpdigital.push.AdpPushClient;
import com.adpdigital.push.config.Environment;


public class MainApplication extends FlutterApplication {
    public void onCreate() {
        AdpPushClient.configureEnvironment(Environment.SANDBOX); // or PRODUCTION

Getting started - iOS

  1. Ensure your iOS projects Pods are up-to-date:
$ cd ios
$ pod install --repo-update
  1. Initialize Chabok SDK in your AppDelegate.m:
#import "AppDelegate.h"
#import <AdpPushClient/AdpPushClient.h>

- (BOOL)application:(UIApplication *)application
            didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [PushClientManager.defaultManager configureEnvironment:Sandbox]; // or PRODUCTION
    [GeneratedPluginRegistrant registerWithRegistry:self];
    return [super application:application didFinishLaunchingWithOptions:launchOptions];

Basic Usage

In your main.dart:


For initializing the Chabok SDK in dart add bellow lines in import section:

import 'package:chabokpush_flutter/chabokpush.dart';
import 'package:chabokpush_flutter/ChabokEvent.dart';
import 'package:chabokpush_flutter/ChabokMessage.dart';

Login user

To login user in the Chabok service use login method:


Logout user

To logout user in the Chabok service use logout method:


Set user attributes

To set user attributes in the Chabok service use setUserAttributes method:

ChabokPush.shared.setUserAttributes(<String, dynamic> {
  'firstName': 'Hossein',
  'lastName': "Shooshtari",
  'age': 27,
  'birthday': new DateTime(1993),
  'isVIP': true,
  'friends': ['hussein', 'farbod']

Unset user attributes

To unset user attributes in the Chabok service user unsetUserAttributes method:


Getting message

To get the Chabok message call setOnMessageCallback:

ChabokPush.shared.setOnMessageCallback((message) {
  var msg = json.decode(message);
  print('Got message = $msg');

Getting connection status

To get connection state call setOnConnectionHandler:

ChabokPush.shared.setOnConnectionHandler((status) {
  print('Connection status = $status');

Publish message

For publishing a message use publish method:

ChabokPush.shared.publish(new ChabokMessage(

Subscribe on channel

To subscribe on a channel use subscribe method:

  .then((channel) {
    print('successfully subscribed on channel: $channel');
  }).catchError((error) {
    print('failed to subscribe on channel with error: $error');

Unsubscribe from channel

To unsubscribe from channel use unSubscribe method:

  .then((channel) {
    print('successfully unsubscribed from channel: $channel');
  }).catchError((error) {
    print('failed to unsubscribe from channel with error: $error');


To track user interactions use track method :

ChabokPush.shared.track("AddToCart", <String, dynamic> {
  'orderId': 'order_123',
  'orderDate': new,
  'isBlackFriday': true,
  'orderSize': 69

Add tag

Adding tag to user use addTag method:

  .then((response) {
    print('successfully add tag');
  }).catchError((error) {
      print('failed to add tag with error: $error');

Remove tag

Removing tag from user use removeTag method:

  .then((response) {
    print('successfully remove tag');
  }).catchError((error) {
      print('failed to remove tag with error: $error');


I see Errno::ENOENT - No such file or directory @ rb_sysopen - ./ios/Pods/Local Podspecs/chabokpush.podspec.json when I build an iOS app.

Clean your project, remove ios/Podfile and Xcode workspace file entirely. (make sure you have backups just in case)

flutter clean
rm -rf ios/Podfile ios/Podfile.lock pubspec.lock ios/Pods ios/Runner.xcworkspace

Revert to cocoapods 1.7.5 temporarily.

gem uninstall cocoapods
gem install cocoapods -v 1.7.5

Add the following line to the beginning of your iOS project's generated Podfile.

# Beginning of file

# The rest of the file contents
# ...

Install pods.

pod repo update
cd ios
pod install
cd ..

Retry your build.

Once your build is successful, you can update cocoapods back to its latest version. If the error reoccurs, you will have to revert back to 1.7.5 and retry the steps.