Unofficial Pusher Beams Flutter client library supported for iOS and Android.
Note: the plugin API have been designed with the same parameters and functions names as the native SDKs
iOS Documentation | Android Documentation
- You need a Pusher Beams instance to get an
instanceId
, you can get one from here
Follow the FlutterFore installation guide from the following packages on your Flutter app as Pusher Beams itself requires FCM to work:
- firebase_messaging (This is important, follow and read everything)
- firebase_core
- firebase_analytics (Required by Firebase itself)
Once the above have been set up, you must include this plugin on your pubspec.yaml
:
dependencies:
pusher_beams: "^0.5.3+3"
Get the instanceId
from your Pusher Beams panel and call .start()
as soon as possible on your app:
import 'package:pusher_beams/pusher_beams.dart'; // Import the plugin
// Stuff
void main () async {
// Your app setup
// We start PusherBeams before the app
await PusherBeams.start('YOUR INSTANCE ID');
runApp(SomeApp());
}
Once PusherBeams were started you can now start to add, remove or get the interests you need as follows:
import 'package:pusher_beams/pusher_beams.dart'; // Import the plugin
await PusherBeams.addDeviceInterest("hello");
await PusherBeams.removeDeviceInterest("hello");
await PusherBeams.getDeviceInterests();
- I decided not to write the function documentation as they were implemented the same as their native libraries, you can read it here.
- Every function on this Plugin is a Dart Future.
- Remember this library have been implemented as a Singleton (the native libraries follows this pattern).
- Send from flutter serializable
AuhtorizationOptions
for custom UNAuthorizationOptions. setUserId
implementation to add the authentication part- Flutter Web support
Developed with ❤️