firebase - 推送 Notificatblanion Firebase 失败 - 错误消息为空
问题描述
我收到 Pushnotification 的空白错误消息 - firebase
除推送通知外,所有通知均有效。我们需要在 Firebase 中启用任何特定设置吗?
我放置在提供推送通知的大部分颤振设置下方。
class PushNotificationsBloc
extends Bloc<PushNotificationsEvent, PushNotificationsState> {
final UserDataRepository userDataRepository;
PushNotificationsBloc({this.userDataRepository})
: super(PushNotificationsInitial());
@override
Stream<PushNotificationsState> mapEventToState(
PushNotificationsEvent event,
) async* {
if (event is SendNewNotification) {
yield* mapSendNewNotificationToState(event.map);
}
}
Stream<PushNotificationsState> mapSendNewNotificationToState(Map map) async* {
yield SendNewNotificationInProgressState();
try {
String res = await userDataRepository.sendNewNotification(map);
if (res != null) {
yield SendNewNotificationCompletedState(res);
} else {
yield SendNewNotificationFailedState();
}
} catch (e) {
print(e);
yield SendNewNotificationFailedState();
}
}
}
@immutable
abstract class PushNotificationsState {}
class PushNotificationsInitial extends PushNotificationsState {}
class SendNewNotificationCompletedState extends PushNotificationsState {
final String res;
SendNewNotificationCompletedState(this.res);
}
class SendNewNotificationFailedState extends PushNotificationsState {}
class SendNewNotificationInProgressState extends PushNotificationsState {}
解决方案
推荐阅读
- airflow - XCOM 变量推送失败
- python - Python中自然三次样条计算的完整算法(数学)?
- javascript - Offscreen-Canvas 有时不渲染
- r - R plotly subplot 警告“布局”对象没有这些属性:“NA”
- colors - 我想获得颜色 X。我有一组颜色 Y。是否有一些代码/公式可以找到从 Y 组中获得颜色 X 需要多少颜色?
- angular - Angular Slick 复制/粘贴实现 onKeyDown 事件仅捕获“ ctrl ”键,但不捕获“ ctrl + c ”
- scala - 布尔 Scala / Chisel 的选项方法
- android - Kotlin Adapter OnMapReady 获取位置
- apache-kafka - 对不同的 kafka 主题使用相同的消费者组
- jquery - Kendo Grid 客户端模板输入验证