From acc70a5e29743707091b9e3d212de0dd33df6148 Mon Sep 17 00:00:00 2001 From: nikolay-vasilev-prime Date: Mon, 3 Feb 2025 13:03:50 +0200 Subject: [PATCH] Move the push token error in the service --- .../lib/feature_notifications/blocs/notifications_bloc.dart | 1 - .../services/notifications_service.dart | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/blocs/notifications_bloc.dart b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/blocs/notifications_bloc.dart index 791f86a14..81336d305 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/blocs/notifications_bloc.dart +++ b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/blocs/notifications_bloc.dart @@ -43,6 +43,5 @@ class NotificationsBloc extends $NotificationsBloc { (_) => _service.getPushToken().asResultStream(), ) .setResultStateHandler(this) - .mapResult((token) => token ?? (throw NotFoundErrorModel())) .publish(); } diff --git a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/services/notifications_service.dart b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/services/notifications_service.dart index 627712989..c8f5b8f17 100644 --- a/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/services/notifications_service.dart +++ b/packages/rx_bloc_cli/mason_templates/bricks/rx_bloc_base/__brick__/lib/feature_notifications/services/notifications_service.dart @@ -1,5 +1,6 @@ {{> licence.dart }} +import '../../base/models/errors/error_model.dart'; import '../../base/repositories/push_notification_repository.dart'; class NotificationService { @@ -7,6 +8,6 @@ class NotificationService { final PushNotificationRepository _repository; - Future getPushToken() => - _repository.getToken(); + Future getPushToken() async => + await _repository.getToken() ?? (throw NotFoundErrorModel()); }