-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
32 lines (26 loc) · 882 Bytes
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import 'package:flutter/material.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_core/firebase_core.dart';
import 'screens/home_screen.dart';
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
print("Handling background message: ${message.messageId}");
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
final fcmToken = await FirebaseMessaging.instance.getToken();
print("FCM Token: $fcmToken");
runApp(FESApp());
}
class FESApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'FES Mobile',
theme: ThemeData.dark(),
home: HomeScreen(),
);
}
}