initialize method
Implementation
static Future initialize({
@required String forgroundIconName,
@required String androidChannelId,
@required String androidChannelName,
@required String androidChannelDescription,
String Function(String key, List<String> args) translateMessage,
}) async {
WidgetsFlutterBinding.ensureInitialized();
_androidChannelId = androidChannelId;
_androidChannelName = androidChannelName;
_androidChannelDescription = androidChannelDescription;
_translateMessage = translateMessage;
_firebaseMessaging.configure(
onMessage: _onForgroundNotification,
onLaunch: _onNotificationLaunch,
onResume: _onResume,
);
_iOSPermission();
var initializationSettingsAndroid =
AndroidInitializationSettings(forgroundIconName);
var initializationSettingsIOS = IOSInitializationSettings();
var initializationSettings = InitializationSettings(
android: initializationSettingsAndroid, iOS: initializationSettingsIOS);
_localeNotification.initialize(initializationSettings,
onSelectNotification: _onSelectLocaleNotification);
var luanchDetails =
await _localeNotification.getNotificationAppLaunchDetails();
if (luanchDetails != null &&
_luanchedNotification == null &&
luanchDetails.didNotificationLaunchApp &&
luanchDetails.payload != null) {
_luanchedNotification = FCMNotification.fromJson(
jsonDecode(luanchDetails.payload), _translateMessage);
}
}