firebase_cloud_messaging_interop 1.0.1 firebase_cloud_messaging_interop: ^1.0.1 copied to clipboard
A dart plugin allowing you to retrieve the firebase token of the client and to send push notification (via firebase).
example/firebase_cloud_messaging_interop_example.dart
import 'package:firebase_cloud_messaging_interop/firebase_cloud_messaging_interop.dart';
import 'dart:html';
main() {
Messaging messaging = firebase.messaging();
messaging.usePublicVapidKey("YOUR_VAPID_KEY");
/// Ask for permission to send notification
Notification.requestPermission().then((permission) {
if (permission == 'granted') {
futureFromPromise(messaging.getToken().then((e) {
/// SEND TOKEN TO THE BACKEND SERVER
}));
}
else {
/// User does'nt want notification :(
}
});
}