pusher_beams 0.5.3+1 pusher_beams: ^0.5.3+1 copied to clipboard
Unofficial Pusher Beams Flutter client library supported for iOS and Android.
Flutter Pusher Beams (Client) #
Unofficial Pusher Beams Flutter client library supported for iOS and Android.
Note: the plugin API is develop with the same parameters and functions names as the native SDK
iOS Documentation | Android Documentation
Installation Guide #
- Create a pusher
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:
firebase_messaging: "^0.5.3+1"
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();
Notes #
- 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).
Todo #
- Send from flutter serializable
AuhtorizationOptions
for custom UNAuthorizationOptions. setUserId
implementation to add the authentication part
Developed with ❤️