initialize method
Implementation
Future<void> initialize() async {
if (Platform.isAndroid) {
await FirebaseMessaging.instance.setAutoInitEnabled(true);
}
localNotificationsPlugin = FlutterLocalNotificationsPlugin();
_setupNotifications();
await FirebaseMessaging.instance
.setForegroundNotificationPresentationOptions(
badge: true, sound: true, alert: true);
PackageInfo packageInfo = await PackageInfo.fromPlatform();
_appName = packageInfo.appName;
await checkPermissions();
_onMessage();
}