Skip to content

Instantly share code, notes, and snippets.

View TesteurManiak's full-sized avatar
🎯
Dart/Flutter Software Engineer

Guillaume Roux TesteurManiak

🎯
Dart/Flutter Software Engineer
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_fcm_web_example/notification_helper.dart';
import 'package:firebase/firebase.dart' as firebaseWeb;
import 'package:flutter_fcm_web_example/notification_model.dart';
/// Web-only helper to manage notifications.
class FirebaseMessagingHelper implements NotificationHelper {
FirebaseMessagingHelper._internal();
import 'dart:async';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_fcm_web_example/notification_helper.dart';
import 'package:flutter_fcm_web_example/notification_model.dart';
/// Mobile-only helper to manage notifications.
class FirebaseMessagingHelper implements NotificationHelper {
FirebaseMessagingHelper._internal();
import 'package:flutter_fcm_web_example/notification_model.dart';
abstract class NotificationHelper {
Future<bool> get isReady;
Stream<NotificationModel> get stream;
void close();
Future<String> getToken([bool force = false]);
Future<dynamic> requestPermission();
}
@TesteurManiak
TesteurManiak / index.html
Last active October 14, 2020 14:53
flutter_fcm_web_example/index1.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
@TesteurManiak
TesteurManiak / main.dart
Created October 14, 2020 12:52
flutter_fcm_web_example/main.dart
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_fcm_web_example/my_app.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}