pushbots 0.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 18

= PushBots Flutter SDK

A library for Dart developers. Help you manage notifications easily and effectively.

== Usage

Use this package as a library

1- Depend on it

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

[source, bash] #

dependencies: pushbots: ^0.0.4 #

<<<

2- Install it

You can install packages from the command line:

with Flutter:

[source, bash] #

$ 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:

[source, bash] #

import 'package:pushbots/pushbots.dart'; #

<<< === Android Setup

Add to defaultConfig section, then replace PUSHBOTS_APP_ID and GOOGLE_SENDER_ID

[source,groovy] #

defaultConfig { // Add PushBots integration data manifestPlaceholders = [ pushbots_app_id : "YOUR_APP_ID", pushbots_loglevel : "DEBUG", google_sender_id : "YOUR_SENDER_ID" ]

}

<<<

=== Flutter Usage

Once added pushbots into your pubspec.yaml.

==== Initializing PushBots:-

You can start by initializing the PushBots by calling Pushbots.init();

==== Register For RemoteNotification:-

Register for notification by Pushbots.registerForNotification();

<<<

Listen for notifiers (receive, open) notifications:-

[source,dart] #

Pushbots.listenForNotificationReceive().stream.listen((onData) { print("MAIN, received: " + onData.toString()); });

Pushbots.listenForNotificationOpen().stream.listen((onData){ print("MAIN, opened: " + onData.toString()); });


<<<

Update User info:-

[source, dart] .main.dart #

Pushbots.setName("Pushbotter"); Pushbots.setFirstName("FirstName"); Pushbots.setLastName("LastName"); Pushbots.setEmail("email@email.com"); Pushbots.setAlias("Alias");


== Feature and bugs

Please fill issue on https://github.com/pushbots or https://stackoverflow.com/questions/tagged/pushbots

0.0.5 #

0.0.4 #

0.0.3 #

  • Get notifier working i.e:-
 Pushbots.listenForNotificationReceive().stream.listen((onData) {
      print("MAIN, received: " + onData.toString());
    });

0.0.2 #

  • Update Readme.md

0.0.1 #

  • Initial release which support #android

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:pushbots/pushbots.dart';

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  String pbInitState = 'PushBots did not initialized yet...';
  String pbRegisterInfo = 'PushBots Register Status';

  bool switchState = true;

  @override
  void initState() {
    super.initState();

    initPushBots();
    registerForNotification();
    Pushbots.setLogLevel("DEBUG", "INFO");

    Pushbots.listenForNotificationReceive().stream.listen((onData) {
      print("MAIN, received: " + onData.toString());
      Map value = json.decode(onData.toString());
      print("After converted to map ! " + value.toString());
    });

    Pushbots.listenForNotificationOpen().stream.listen((onData) {
      print("MAIN, opened: " + onData.toString());
    });

    Pushbots.setName("Pushbotter");
    Pushbots.setFirstName("Pushbots");
    Pushbots.setLastName("Pushbots");
    Pushbots.setEmail("info@pushbots.com");
    Pushbots.setPhone("000111222333");
    //Pushbots.shareLocation(true);
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPushBots() async {
    String initStatue;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      initStatue = await Pushbots.init();
    } on Exception {
      initStatue = 'Failed to get initialize push-bots.';
    }
    setState(() {
      pbInitState = initStatue;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin PushBots app'),
        ),
        body: Center(
          child: new Column(
            children: <Widget>[
              Text('$pbInitState\n'),
              Switch(
                value: switchState,
                onChanged: (val) => setState(() {
                  switchState = val;
                  Pushbots.toggleNotifications(switchState);
                }),
              ),
              Text('$pbRegisterInfo\n'),
            ],
          ),
        ),
      ),
    );
  }

  Future<void> registerForNotification() async {
    String result;

    try {
      result = await Pushbots.registerForNotification();
    } on Exception {
      result = "Failed to register for notification";
    }

    setState(() {
      pbRegisterInfo = result;
    });
  }
}
/**/

Use this package as a library

1. Depend on it

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


dependencies:
  pushbots: ^0.0.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:pushbots/pushbots.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
18
Learn more about scoring.

This package is not analyzed, because it is discontinued.

Health issues and suggestions

Document public APIs. (-1 points)

31 out of 31 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0