pubnub_flutter 1.0.3

Pubnub Flutter #

Currently available for Android only.

Pubnub plugin for Flutter apps built by Deligence Technologies. This plugin lets you integrate Pubnub in your app.

Minimum Requirements #

Android : To use this plugin you must migrate to AndroidX and set your minSdkVersion to at least 20.

Methods to use #

To Initialize #

 PubnubFlutter pubNubFlutter=PubnubFlutter();
// Getting random ID genetrated by android
String myId =await  pubNubFlutter.getUuidString();

//Initializing the plugin
pubNubFlutter=await pubNubFlutter.initialize(
           publishKey: "PUBLISH KEY",
           subscribeKey: "SUSBSCRIBE KEY",
           uuid: myId, // you can use any random Id 
           secretKey: "YOUR SECRET KEY");

Listen to change in status or msg #

  pubNubFlutter.onStatusReceived.listen((status) {
         print("check your status $status ");
    });

  pubNubFlutter.onMessageReceived.listen((msg) {
         print("\n\n RECEIVED MESSAGE IS $msg \n\n");
    });

Subscribe to channels #

// return true || false based on result
bool sub = await pubNubFlutter.subscribe(channelNames:['test@234']);

Publish msg to a channel #

// Data should be of type Map<String,String>
data={"msg":"Something something something ...."};

// return true || false based on result
 bool msg=await pubNubFlutter.sendMessage(data: data, channel: channel);

Unsubscribe to channels #


// return true || false based on result
pubNubFlutter.unsubscribe();

Note #

Currently this plugin is in development so their could be some breaking changes in next update.

Unsubscribe to a single or multiple channel is yet not supported by this plugin.

1.0.3 #

  • Added documentation

1.0.2 #

  • Working Now

1.0.0 #

  • TODO: Describe initial release

0.0.9 #

  • TODO: Describe initial release

0.0.8 #

  • TODO: Describe initial release

0.0.7 #

  • TODO: Describe initial release

0.0.6 #

  • TODO: Describe initial release

0.0.5 #

  • TODO: Describe initial release.

0.0.4 #

  • TODO: Describe initial release.

0.0.3 #

  • TODO: Describe initial release.

0.0.2 #

  • TODO: Describe initial release.

0.0.1 #

  • TODO: Describe initial release.

example/README.md

pubnub_flutter_example #

Demonstrates how to use the pubnub_flutter plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  pubnub_flutter: ^1.0.3

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:pubnub_flutter/pubnub_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/fun/native.dart. (-1 points)

Analysis of lib/fun/native.dart reported 2 hints:

line 5 col 8: Unused import: 'package:pubnub_flutter/model/pn-message-result.dart'.

line 55 col 12: The value of the local variable 'result' isn't used.

Format lib/model/pn-message-result.dart.

Run flutter format to format lib/model/pn-message-result.dart.

Format lib/pubnub_flutter.dart.

Run flutter format to format lib/pubnub_flutter.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test