import 'package:flutter/material.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
@override
void initState() {
super.initState();
_configureFirebaseMessaging();
}
void _configureFirebaseMessaging() {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('onMessage: $message');
},
onLaunch: (Map<String, dynamic> message) async {
print('onLaunch: $message');
},
onResume: (Map<String, dynamic> message) async {
print('onResume: $message');
},
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Flutter Push Notifications'),
),
body: Center(
child: Text(
'Implement push notifications with AWS services in Flutter',
style: TextStyle(fontSize: 20),
),
),
),
);
}
}
void main() {
runApp(MyApp());
}