Flutter Push -уведомление о функции не работаетIOS

Программируем под IOS
Anonymous
Flutter Push -уведомление о функции не работает

Сообщение Anonymous »

Я разрабатываю приложение Flutter с Push -уведомлением от Firebase и разрабатываю в своем iPhone. Функция уведомления работает, но я хочу добавить функцию перенаправления (перенаправление на специальную страницу (имя маршрута - «/map").образное, Функция ondidReceivenotificationResponse будет вызоваться, когда я нажимаю на сообщение об уведомлении, но она будет повторять код в код ondidReceiensifitionresses , но не является функцией Redirect. /> Вывод журнала < /p>

Flutter: Уведомление о полезной нагрузке:

Flutter: ondidReceivenotificationResponse

flutter: уведомление:

flutter: ondidreceivensresponse

flutter: ondidReceivensresponse

flutter: ondidreceivencresponse

flutter: ondidreceivencressponseresseson />
Flutter: OnDidReceivenotificationResponse < /p>
< /blockquote>
class NotificationService {
final notificationPlugin = FlutterLocalNotificationsPlugin();
static final onNotifications = BehaviorSubject();
bool _isInitialized = false;
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();

Future initNotification() async {
print("NotificationService initNotification 1");
if (_isInitialized) return;

const initSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher');

const initSettingsIOS = DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
);

void onDidReceiveNotificationResponse(
NotificationResponse notificationResponse) async {
final String? payload = notificationResponse.payload;
if (notificationResponse.payload != null) {
debugPrint('notification payload: $payload');
debugPrint('onDidReceiveNotificationResponse');
AppGlobal.navigatorKey.currentState?.pushNamed('/map');
}
}

const initSetting = InitializationSettings(
android: initSettingsAndroid, iOS: initSettingsIOS);
await flutterLocalNotificationsPlugin.initialize(initSetting,
onDidReceiveNotificationResponse: (notificationResponse) =>
onDidReceiveNotificationResponse(notificationResponse));
_isInitialized = !_isInitialized;
}


Подробнее здесь: https://stackoverflow.com/questions/796 ... n-not-work

Вернуться в «IOS»