netmera_flutter_sdk 0.0.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

Netmera Flutter SDK #

NETMERA is a Mobile Application Engagement Platform. We offer a series of development tools and app communication features to help your mobile business ignite and soar.

Installation #

For using this package as a library: #
  • Add this to your package's pubspec.yaml file
dependencies:
  netmera_flutter_sdk: ^x.x.x
  • You can install packages from the command line with Flutter:
$ flutter pub get

For both native sides(Android & iOS) you don't have to include extra Netmera SDK libraries.

Setup - Android Part #

  1. Create and register your app in Firebase console.

  2. Download google-services.json file and place it into android/app/ folder.

  3. In your project's build gradle file, add the following dependency.

buildscript {
  dependencies {
    // Add this line
    classpath 'com.google.gms:google-services:4.2.0'
  }
}
  1. In your app's build gradle file, add the following dependency.

 dependencies {
 
     implementation 'androidx.core:core:1.1.0'
     
 }
  1. Add the following into the bottom of app's buid.gradle file
apply plugin: 'com.google.gms.google-services'
  1. Create an application class as shown below.
  • Your Application class must extends FlutterApplication and implements PluginRegistry.PluginRegistrantCallback , if you want to listen Push Broadcasts in dart part.
public class NMApp extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback {

      @Override
      public void onCreate() {

          super.onCreate();

          FNetmeraService.setPluginRegistrant(this); // This is needed for receiving push broadcasts in dart classes
          FNetmera.logging(true); // This is for enabling Netmera logs.
          FNetmera.init(this, <YOUR GCM SENDER ID>, <YOUR NETMERA API KEY>); // Calling Netmera init.
      }

      @Override
      public void registerWith(PluginRegistry pluginRegistry) {
          GeneratedPluginRegistrant.registerWith(pluginRegistry);
      }
  }
  1. Register Application and Service classes into manifest file.
 <application
        android:name=".NMApp"
        android:label="netmera_flutter_sdk_example"
        android:icon="@mipmap/ic_launcher">

        <!-- Register broadcast class as below -->
        <receiver
            android:name="com.netmera.netmera_flutter_sdk.FNetmeraPushBroadcastReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.netmera.push.intent.REGISTER" />
                <action android:name="com.netmera.push.intent.RECEIVE" />
                <action android:name="com.netmera.push.intent.OPEN" />
                <action android:name="com.netmera.push.intent.DISMISS" />
                <action android:name="com.netmera.push.intent.BUTTON" />
            </intent-filter>
        </receiver>

         <!-- Register service class as below -->
        <service
            android:name="com.netmera.netmera_flutter_sdk.FNetmeraService"
            android:exported="true"
            android:permission="android.permission.BIND_JOB_SERVICE">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </service>

        ...
        ..
        .
  1. Inside dart class add the following
void main() {
  initBroadcastReceiver();
  runApp(MyApp());
}

void _onPushRegister(Map<dynamic, dynamic> bundle) async {
  print("onPushRegister: $bundle");
}

void _onPushReceive(Map<dynamic, dynamic> bundle) async {
  print("onPushReceive: $bundle");
}

void _onPushDismiss(Map<dynamic, dynamic> bundle) async {
  print("onPushDismiss: $bundle");
}

void _onPushOpen(Map<dynamic, dynamic> bundle) async {
  print("onPushOpen: $bundle");
}

void _onPushButtonClicked(Map<dynamic, dynamic> bundle) async {
  print("onPushButtonClicked: $bundle");
}

void initBroadcastReceiver() {
  NetmeraPushBroadcastReceiver receiver = new NetmeraPushBroadcastReceiver();
  receiver.initialize(
    onPushRegister: _onPushRegister,
    onPushReceive: _onPushReceive,
    onPushDismiss: _onPushDismiss,
    onPushOpen: _onPushOpen,
    onPushButtonClicked: _onPushButtonClicked,
  );
}

Setup - iOS Part #

  1. Navigate to ios folder in your terminal and run the following command.
$ pod install
  1. If you are using Swift, enter the following in your Runner-Bridging-Header.h.
#import "FNetmera.h"
#import "FNetmeraService.h"
#import "NetmeraFlutterSdkPlugin.h"
  1. If you want to use Android alike message sending from iOS to dart please consider to shape your AppDelegate class as following.
import UIKit
import Flutter

//This function is needed for sending messages to the dart side. (Setting the callback function)
func registerPlugins(registry: FlutterPluginRegistry) {
    GeneratedPluginRegistrant.register(with: registry)
};

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate,UNUserNotificationCenterDelegate,NetmeraPushDelegate {

    override func application(_ application: UIApplication,
                didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    GeneratedPluginRegistrant.register(with: self)

        if #available(iOS 10.0, *) {
        UNUserNotificationCenter.current().delegate = self
    } else {
        // Fallback on earlier versions
    };

        //For triggering onPushReceive when app is killed and push clicked by user
        let notification = launchOptions?[.remoteNotification]
        if notification != nil {
            self.application(application, didReceiveRemoteNotification: notification as! [AnyHashable : Any])
        }

    //This function is needed for sending messages to the dart side.
    NetmeraFlutterSdkPlugin.setPluginRegistrantCallback(registerPlugins)

    FNetmera.logging(true) // Enable Netmera logging
    FNetmera.init("<YOUR-NETMERA-KEY>") //Initializing Netmera packages.
    FNetmera.setPushDelegate(self) //

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }


    override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        FNetmeraService.handleWork(ON_PUSH_REGISTER, dict: ["pushToken": deviceToken])
    }

    override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
        FNetmeraService.handleWork(ON_PUSH_RECEIVE, dict:["userInfo" : userInfo])
    }


    @available(iOS 10.0, *)
    func userNotificationCenter(_ center: UNUserNotificationCenter,
                                didReceive response: UNNotificationResponse,
                                withCompletionHandler completionHandler:
        @escaping () -> Void) {

        if response.actionIdentifier == UNNotificationDismissActionIdentifier {
            FNetmeraService.handleWork(ON_PUSH_DISMISS,dict:["userInfo" : response.notification.request.content.userInfo])
        }
        else if response.actionIdentifier == UNNotificationDefaultActionIdentifier {
            FNetmeraService.handleWork(ON_PUSH_OPEN, dict:["userInfo" : response.notification.request.content.userInfo])
        }
        completionHandler()
    }

    @available(iOS 10.0, *)
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        completionHandler([UNNotificationPresentationOptions.alert])
    }
}

For example if you trigger FNetmeraService.handleWork(ON_PUSH_RECEIVE, dict:["userInfo" : userInfo]) from AppDelegate, in the dart part the following method will be triggered.

void _onPushReceive(Map<dynamic, dynamic> bundle) async {
  print("onPushReceive: $bundle");
}

Please take a look at Setup-Android part 8

Calling Dart methods #

Update User Example #
updateUser() {
    NetmeraUser user = new NetmeraUser();
    user.setUserId(userController.text);
    user.setName(nameController.text);
    user.setSurname(surnameController.text);
    user.setEmail(emailController.text);
    user.setMsisdn(msisdnController.text);
    user.setGender(int.parse(_selectedGender));
    Netmera.updateUser(user);
  }
Sending Event Examples #
  void sendLoginEvent() {
    NetmeraEventLogin loginEvent = new NetmeraEventLogin();
    Netmera.sendEvent(loginEvent);
  }

  void sendRegisterEvent() {
    NetmeraEventRegister registerEvent = new NetmeraEventRegister();
    Netmera.sendEvent(registerEvent);
  }

  void sendViewCartEvent() {
    NetmeraEventCartView cartViewEvent = new NetmeraEventCartView();
    cartViewEvent.setItemCount(3);
    cartViewEvent.setSubTotal(15.99);
    Netmera.sendEvent(cartViewEvent);
  }

  void purchaseEvent() {
    NetmeraLineItem netmeraLineItem = new NetmeraLineItem();
    netmeraLineItem.setBrandId("brandId12");
    netmeraLineItem.setBrandName("brandNameInomera");
    netmeraLineItem.setCampaignId("campaignId1223");
    netmeraLineItem.setCategoryIds(["categoryIds1", "categoryIds2"]);
    netmeraLineItem.setCategoryNames(["categoryNames1", "categoryNames2", "categoryNames3"]);
    netmeraLineItem.setKeywords(["keyword1", "keyword2", "keyword3"]);
    netmeraLineItem.setCount(12);
    netmeraLineItem.setId("Id123123");
    netmeraLineItem.setPrice(130);

    NetmeraEventPurchase purchaseEvent = new NetmeraEventPurchase();
    purchaseEvent.setCoupon("INOMERACODE");
    purchaseEvent.setDiscount(10);
    purchaseEvent.setItemCount(2);
    purchaseEvent.setPaymentMethod("Credit Card");
    purchaseEvent.setSubTotal(260.89);
    purchaseEvent.setShippingCost(0.0);
    purchaseEvent.setLineItems([netmeraLineItem, netmeraLineItem]);
    Netmera.sendEvent(purchaseEvent);
  }

For detailed information please explore example folder in the netmera sdk library.

0.0.1 #

  • Initial project release for testing.
  • Netmera Android & iOS initial integrations were completed.
  • All general event mechanisms were added.
  • Push broadcast mechanisms for Android Supported devices were integrated into dart language.

0.0.2 #

  • ReadMe was updated.

0.0.3 #

  • example/ReadMe was updated.

0.0.4 #

  • AndroidX support was added.

0.0.5 #

  • AndroidX core dependency was included and ReadMe was updated.

0.0.6 #

  • Minor bug fix for AndroidX and ReadMe was updated.

0.0.7 #

  • use_frameworks! enabled for iOS part.

example/README.md

Simple showcase #

main.dart


import 'dart:io';

import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/Netmera.dart';
import 'package:netmera_flutter_sdk/NetmeraPushBroadcastReceiver.dart';

import 'page_event.dart';
import 'page_push_inbox.dart';
import 'page_settings.dart';
import 'page_user.dart';

///
/// Copyright (c) 2019 Inomera Research.
/// Author Burak Soykal
///
void main() {
  initBroadcastReceiver();
  runApp(MyApp());
}

void _onPushRegister(Map<dynamic, dynamic> bundle) async {
  print("onPushRegister: $bundle");
}

void _onPushReceive(Map<dynamic, dynamic> bundle) async {
  print("onPushReceive: $bundle");
}

void _onPushDismiss(Map<dynamic, dynamic> bundle) async {
  print("onPushDismiss: $bundle");
}

void _onPushOpen(Map<dynamic, dynamic> bundle) async {
  print("onPushOpen: $bundle");
}

void _onPushButtonClicked(Map<dynamic, dynamic> bundle) async {
  print("onPushButtonClicked: $bundle");
}

void initBroadcastReceiver() {
  NetmeraPushBroadcastReceiver receiver = new NetmeraPushBroadcastReceiver();
  receiver.initialize(
    onPushRegister: _onPushRegister,
    onPushReceive: _onPushReceive,
    onPushDismiss: _onPushDismiss,
    onPushOpen: _onPushOpen,
    onPushButtonClicked: _onPushButtonClicked,
  );
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    Netmera.logging(true);

    Netmera.isPushEnabled().then((enabled) {
      print("Netmera: isPushEnabled = " + enabled.toString());
    });

    if (Platform.isIOS) {
      Netmera.requestPushNotificationAuthorization();
      Netmera.setAppGroupName("AppGroupName");
    }

    if (Platform.isAndroid) {
      Netmera.isWebViewProgressbarEnabled().then((enabled) {
        print("Netmera: isWebViewProgressbarEnabled = " + enabled.toString());
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 4,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Text("Event")),
                Tab(icon: Text("User")),
                Tab(icon: Text("PushInbox")),
                Tab(icon: Text("Settings")),
              ],
            ),
            title: Text('NM Flutter SDK'),
          ),
          body: TabBarView(
            children: [EventPage(), UserPage(), PushInboxPage(), SettingsPage()],
          ),
        ),
      ),
    );
  }
}

page-user.dart

import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/Netmera.dart';
import 'package:netmera_flutter_sdk/NetmeraUser.dart';
import 'model/MyNetmeraUser.dart';

///
/// Copyright (c) 2019 Inomera Research.
/// Author Burak Soykal
///
class UserPage extends StatefulWidget {
  @override
  _UserPageState createState() => _UserPageState();
}

class _UserPageState extends State<UserPage> {
  TextEditingController userController = TextEditingController();
  TextEditingController nameController = TextEditingController();
  TextEditingController surnameController = TextEditingController();
  TextEditingController emailController = TextEditingController();
  TextEditingController msisdnController = TextEditingController();
  String _selectedGender = NetmeraUser.GENDER_NOT_SPECIFIED.toString();

  updateUser() {
    MyNetmeraUser user = new MyNetmeraUser();
    user.setUserId(userController.text);
    user.setName(nameController.text);
    user.setSurname(surnameController.text);
    user.setEmail(emailController.text);
    user.setMsisdn(msisdnController.text);
    user.setGender(int.parse(_selectedGender));
    user.setHairColor(7);
    Netmera.updateUser(user);
  }

  List<DropdownMenuItem<String>> getGenderList() {
    List<DropdownMenuItem<String>> items = new List();
    items.add(
        new DropdownMenuItem(value: NetmeraUser.GENDER_NOT_SPECIFIED.toString(), child: new Text("NOT SPECIFIED")));
    items.add(new DropdownMenuItem(value: NetmeraUser.GENDER_MALE.toString(), child: new Text("MALE")));
    items.add(new DropdownMenuItem(value: NetmeraUser.GENDER_FEMALE.toString(), child: new Text("FEMALE")));
    return items;
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Padding(
            padding: const EdgeInsets.only(left: 50.0, right: 50.0),
            child: TextField(
              controller: userController,
              decoration: InputDecoration(labelText: 'User (Optional)'),
            ),
          ),
          Padding(
              padding: const EdgeInsets.only(left: 50.0, right: 50.0),
              child: TextField(
                controller: nameController,
                decoration: InputDecoration(labelText: 'Name (Optional)'),
              )),
          Padding(
              padding: const EdgeInsets.only(left: 50.0, right: 50.0),
              child: TextField(
                controller: surnameController,
                decoration: InputDecoration(labelText: 'Surname (Optional)'),
              )),
          Padding(
              padding: const EdgeInsets.only(left: 50.0, right: 50.0),
              child: TextField(
                controller: emailController,
                decoration: InputDecoration(labelText: 'Email (Optional)'),
              )),
          Padding(
              padding: const EdgeInsets.only(left: 50.0, right: 50.0),
              child: TextField(
                controller: msisdnController,
                decoration: InputDecoration(labelText: 'Msisdn (Optional)'),
              )),
          Padding(
              padding: const EdgeInsets.only(left: 50.0, right: 50.0),
              child: Row(children: [
                Text('Gender (Optional)'),
                Padding(
                    padding: const EdgeInsets.only(left: 10.0),
                    child: DropdownButton(
                        value: _selectedGender,
                        items: getGenderList(),
                        onChanged: (val) {
                          setState(() {
                            _selectedGender = val;
                          });
                        }))
              ])),
          Container(
            margin: EdgeInsets.only(top: 30),
            child: RaisedButton(
              child: Text('Update User'),
              onPressed: updateUser,
            ),
          )
        ],
      ),
    );
  }
}

page-event.dart

import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/Netmera.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventLogin.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventRegister.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventCartView.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventPurchase.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraLineItem.dart';

import 'model/MyNetmeraEvent.dart';

///
/// Copyright (c) 2019 Inomera Research.
/// Author Burak Soykal
///
class EventPage extends StatefulWidget {
  @override
  _EventPageState createState() => _EventPageState();
}

class _EventPageState extends State<EventPage> {
  emptyAction() {}

  void sendLoginEvent() {
    NetmeraEventLogin loginEvent = new NetmeraEventLogin();
    Netmera.sendEvent(loginEvent);
  }

  void sendRegisterEvent() {
    NetmeraEventRegister registerEvent = new NetmeraEventRegister();
    Netmera.sendEvent(registerEvent);
  }

  void sendViewCartEvent() {
    NetmeraEventCartView cartViewEvent = new NetmeraEventCartView();
    cartViewEvent.setItemCount(3);
    cartViewEvent.setSubTotal(15.99);
    Netmera.sendEvent(cartViewEvent);
  }

  void purchaseEvent() {
    NetmeraLineItem netmeraLineItem = new NetmeraLineItem();
    netmeraLineItem.setBrandId("brandId12");
    netmeraLineItem.setBrandName("brandNameInomera");
    netmeraLineItem.setCampaignId("campaignId1223");
    netmeraLineItem.setCategoryIds(["categoryIds1", "categoryIds2"]);
    netmeraLineItem.setCategoryNames(["categoryNames1", "categoryNames2", "categoryNames3"]);
    netmeraLineItem.setKeywords(["keyword1", "keyword2", "keyword3"]);
    netmeraLineItem.setCount(12);
    netmeraLineItem.setId("Id123123");
    netmeraLineItem.setPrice(130);

    NetmeraEventPurchase purchaseEvent = new NetmeraEventPurchase();
    purchaseEvent.setCoupon("INOMERACODE");
    purchaseEvent.setDiscount(10);
    purchaseEvent.setItemCount(2);
    purchaseEvent.setPaymentMethod("Credit Card");
    purchaseEvent.setSubTotal(260.89);
    purchaseEvent.setShippingCost(0.0);
    purchaseEvent.setLineItems([netmeraLineItem, netmeraLineItem]);
    Netmera.sendEvent(purchaseEvent);
  }

  void sendTestEvent() {
    TestEvent1 testEvent = new TestEvent1();
    testEvent.setName("Burak");
    testEvent.setTestAttr1("testAttr1");
    Netmera.sendEvent(testEvent);
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        RaisedButton(
          child: Text('Login Event'),
          onPressed: sendLoginEvent,
        ),
        RaisedButton(
          child: Text('Register Event'),
          onPressed: sendRegisterEvent,
        ),
        RaisedButton(
          child: Text('View Cart Event'),
          onPressed: sendViewCartEvent,
        ),
        RaisedButton(
          child: Text('Purchase Event'),
          onPressed: purchaseEvent,
        ),
        RaisedButton(
          child: Text('Custom Test Event'),
          onPressed: sendTestEvent,
        ),
      ],
    );
  }
}

page_push_inbox.dart

import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/Netmera.dart';
import 'package:netmera_flutter_sdk/NetmeraInboxFilter.dart';
import 'package:netmera_flutter_sdk/NetmeraPushInbox.dart';

///
/// Copyright (c) 2019 Inomera Research.
/// Author Burak Soykal
///
class PushInboxPage extends StatefulWidget {
  @override
  _PushInboxPageState createState() => _PushInboxPageState();
}

class _PushInboxPageState extends State<PushInboxPage> {
  String _currentStatus = Netmera.PUSH_OBJECT_STATUS_ALL.toString();
  String _count = "0";
  List<Widget> _inbox = List();
  List<NetmeraPushInbox> _pushInboxList = List();

  List<DropdownMenuItem<String>> getInboxList() {
    List<DropdownMenuItem<String>> items = new List();
    items.add(new DropdownMenuItem(value: Netmera.PUSH_OBJECT_STATUS_ALL.toString(), child: new Text("ALL")));
    items.add(new DropdownMenuItem(value: Netmera.PUSH_OBJECT_STATUS_READ.toString(), child: new Text("READ")));
    items.add(new DropdownMenuItem(value: Netmera.PUSH_OBJECT_STATUS_UNREAD.toString(), child: new Text("UNREAD")));
    items.add(new DropdownMenuItem(value: Netmera.PUSH_OBJECT_STATUS_DELETED.toString(), child: new Text("DELETED")));
    return items;
  }

  onInboxStatusChanged(String status) {
    setState(() {
      _currentStatus = status;
    });
  }

  clearInboxList() {
    setState(() {
      _inbox.clear();
    });
  }

  String getStatusText(int status) {
    switch (status) {
      case Netmera.PUSH_OBJECT_STATUS_ALL:
        return "ALL";
        break;
      case Netmera.PUSH_OBJECT_STATUS_READ:
        return "READ";
        break;
      case Netmera.PUSH_OBJECT_STATUS_UNREAD:
        return "UNREAD";
        break;
      case Netmera.PUSH_OBJECT_STATUS_DELETED:
        return "DELETED";
        break;
    }
    return "";
  }

  fillInboxList(list) {
    _pushInboxList = list;
    list.forEach((NetmeraPushInbox item) {
      setState(() {
        _inbox.add(Text(item.getTitle() + " (" + getStatusText(item.getInboxStatus()) + ")"));
      });
    });
  }

  // Click Functions
  emptyAction() {}

  getInboxFilter() {
    NetmeraInboxFilter inboxFilter = new NetmeraInboxFilter();
    inboxFilter.setPageSize(2);
    inboxFilter.setStatus(int.parse(_currentStatus));
    inboxFilter.setIncludeExpiredObjects(true);
    inboxFilter.setCategories(null);
    return inboxFilter;
  }

  fetchInbox() async {
    clearInboxList();
    Netmera.fetchInbox(getInboxFilter()).then((list) {
      fillInboxList(list);
    });
  }

  fetchNextPage() async {
    Netmera.fetchNextPage().then((list) {
      if (list.isNotEmpty) {
        clearInboxList();
      }
      fillInboxList(list);
    });
  }

  countForStatus() async {
    Netmera.countForStatus(int.parse(_currentStatus)).then((val) {
      setState(() {
        if (val != -1) {
          _count = val.toString();
        }
      });
    });
  }

  handlePushObject() async {
    if(_pushInboxList.isNotEmpty) {
      Netmera.handlePushObject(_pushInboxList[0].getPushId());
    }
  }

  inboxUpdateStatus() {
    List<String> selectedPushList = List();

    if (_pushInboxList.length > 1) {
      selectedPushList.add(_pushInboxList[0].getPushId());
      selectedPushList.add(_pushInboxList[1].getPushId());
    }

    int status = Netmera.PUSH_OBJECT_STATUS_UNREAD;

    Netmera.inboxUpdateStatus(selectedPushList, status);
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Column(
          children: _inbox,
        ),
        new DropdownButton(
          value: _currentStatus,
          items: getInboxList(),
          onChanged: onInboxStatusChanged,
        ),
        RaisedButton(
          child: Text('Fetch Inbox'),
          onPressed: fetchInbox,
        ),
        RaisedButton(
          child: Text('Fetch Next Page'),
          onPressed: fetchNextPage,
        ),
        RaisedButton(
          child: Text('Count For Status'),
          onPressed: countForStatus,
        ),
        RaisedButton(
          child: Text('Inbox Update Status (Mark first two element as Unread)'),
          onPressed: inboxUpdateStatus,
        ),
        RaisedButton(
          child: Text('Handle Push Object'),
          onPressed: handlePushObject,
        ),
        Text(
          "Count For Status:" + _count,
        )
      ],
    );
  }
}

page_settings.dart

import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/Netmera.dart';

///
/// Copyright (c) 2019 Inomera Research.
/// Author Burak Soykal
///
class SettingsPage extends StatefulWidget {
  @override
  _SettingsPageState createState() => _SettingsPageState();
}

class _SettingsPageState extends State<SettingsPage> {
  disablePopupPresentation() {
    Netmera.disablePopupPresentation();
  }

  enablePopupPresentation() {
    Netmera.enablePopupPresentation();
  }

  requestPermissionsForLocation() {
    Netmera.requestPermissionsForLocation();
  }

  setNetmeraMaxActiveRegions() {
    Netmera.setNetmeraMaxActiveRegions(10);
  }

  turnOffSendingEventAndUserUpdate() {
    Netmera.turnOffSendingEventAndUserUpdate(false);
  }

  toggleWebViewProgressBarVisibility() {
    Netmera.toggleWebViewProgressBarVisibility(true);
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        RaisedButton(
          child: Text('Disable Popup Presentation'),
          onPressed: disablePopupPresentation,
        ),
        RaisedButton(child: Text('Enable Popup Presentation'), onPressed: enablePopupPresentation),
        RaisedButton(
          child: Text('Request Permission For Location'),
          onPressed: requestPermissionsForLocation,
        ),
        RaisedButton(
          child: Text('Set Netmera Max Active Regions'),
          onPressed: setNetmeraMaxActiveRegions,
        ),
        RaisedButton(
          child: Text('Turn Off Sending Event And User Update'),
          onPressed: turnOffSendingEventAndUserUpdate,
        ),
        RaisedButton(
          child: Text('Toggle Web View Progress Bar Visibility (True)'),
          onPressed: toggleWebViewProgressBarVisibility,
        ),
      ],
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  netmera_flutter_sdk: ^0.0.7

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:netmera_flutter_sdk/Netmera.dart';
import 'package:netmera_flutter_sdk/NetmeraInboxFilter.dart';
import 'package:netmera_flutter_sdk/NetmeraPushBroadcastReceiver.dart';
import 'package:netmera_flutter_sdk/NetmeraPushInbox.dart';
import 'package:netmera_flutter_sdk/NetmeraUser.dart';
import 'package:netmera_flutter_sdk/callbackDispatcher.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEvent.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventBannerOpen.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventBatteryLevel.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventCategoryView.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventInAppPurchase.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventLogin.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventRegister.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventScreenView.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventSearch.dart';
import 'package:netmera_flutter_sdk/events/NetmeraEventShare.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventCartAddProduct.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventCartRemoveProduct.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventCartView.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventOrderCancel.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventProductComment.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventProductRate.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventProductView.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventPurchase.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraEventWishList.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraLineItem.dart';
import 'package:netmera_flutter_sdk/events/commerce/NetmeraProduct.dart';
import 'package:netmera_flutter_sdk/events/media/NetmeraEventContent.dart';
import 'package:netmera_flutter_sdk/events/media/NetmeraEventContentComment.dart';
import 'package:netmera_flutter_sdk/events/media/NetmeraEventContentRate.dart';
import 'package:netmera_flutter_sdk/events/media/NetmeraEventContentView.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test