pusher_connect 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

pusher_connect - A Flutter plugin to Pusher.com #

This is a working proof of concept, using the official Android (Java) and iOS (Swift) Pusher libraries to create a working Flutter based solution.

  • You can currently connect to a cluster using an appKey, and to only one channel and event. This can easily be abstracted to allow for multiple subscriptions to channels and events.

Android #

Works

iOS #

Works

0.0.1 #

  • Intitial proof of concept with very minimal functionality; Android works but iOS doesn't. See readme for more details.

1.0.0 #

  • IOS now works, so MVP is basically completed

1.0.1 #

  • Added ios swift version

example/lib/main.dart

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

import 'package:pusher_connect/pusher_connect.dart';

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

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

class _MyAppState extends State<MyApp> {
  PusherConnect pusherConnect = new PusherConnect(
    appKey: "<APPKEY>",
    cluster: "<CLUSTER>",
    channel: "my-channel",
    event: "my-event",
  );

  var text = "Send an event to the pusher channel.";

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    pusherConnect.onRecievedEvents.listen((OnRecievedEvent event) {
      setState(() {
       text = event.data['message']; 
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Pusher Connect Example'),
        ),
        body: Center(
          child: Text(text),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  pusher_connect: ^1.0.1

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

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:pusher_connect/pusher_connect.dart]

Package does not support Flutter platform macos

Because of import path [package:pusher_connect/pusher_connect.dart]

Package does not support Flutter platform web

Because of import path [package:pusher_connect/pusher_connect.dart]

Package does not support Flutter platform windows

Because of import path [package:pusher_connect/pusher_connect.dart]

Package not compatible with SDK dart

because of import path [pusher_connect]

Health issues and suggestions

Document public APIs. (-1 points)

9 out of 9 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.

Format lib/pusher_connect.dart.

Run flutter format to format lib/pusher_connect.dart.

Maintenance suggestions

The package description is too short. (-7 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.

Package is getting outdated. (-6.30 points)

The package was last published 55 weeks ago.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Dependencies

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