laravel_flutter_pusher_plus 1.0.2 laravel_flutter_pusher_plus: ^1.0.2 copied to clipboard
Pusher client that supports laravel echo in flutter projects. Supports Null satefy
Laravel Flutter Pusher Plus #
⚠️ Please Note This is a reworked updated version of the laravel_flutter_pusher packag.
An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS. This is a continued plugin for Flutter Pusher Client
This package lets you consume events from a Pusher server. In order to use this library, you need to have a free account on https://pusher.com. After registering, you will need the application credentials for your app.
NOTE This package requires json_annotation : ^4.0.0
How to install #
- Add to your pubspec.yaml
dependencies:
laravel_flutter_pusher_plus: ^[latest_version]
Getting Started #
import 'package:laravel_flutter_pusher_plus/laravel_flutter_pusher_plus.dart';
void main() {
var options = PusherOptions(
host: '10.0.2.2',
port: 6001,
encrypted: false,
cluster: 'eu'
);
LaravelFlutterPusher pusher = LaravelFlutterPusher('app_key', options, enableLogging: true);
pusher
.subscribe('channel')
.bind('event', (event) => log('event =>' + event.toString()));
}
Lazy Connect #
Connection to the server can be delayed, so set the lazyConnect prop on the client constructor.
R8/Proguard code obfuscation
If you have enabled code obfuscation with R8 or proguard, you need to add the following rule.
android/app/build.gradle
:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android/app/proguard-rules.pro
:
-keep class dev.micazi.laravel_flutter_pusher_plus.** { *; }
Development #
Generate the models and the factories: flutter packages pub run build_runner build --delete-conflicting-outputs