realUpdateNotificationTokenUseCaseProvider top-level property

Provider<UpdateNotificationTokenUseCase> realUpdateNotificationTokenUseCaseProvider
final

Provides a use case for updating the current user's notification token with the backend using API calls.

Implementation

final realUpdateNotificationTokenUseCaseProvider =
    Provider<UpdateNotificationTokenUseCase>(
  (ref) {
    final api = ref.watch(energyManagementV3ApiProvider.future);
    final currentUser = ref.watch(currentUserProvider.future);
    final deviceId = ref.watch(deviceIdProvider.future);
    final token = ref.watch(notificationTokenProvider.future);

    return ApiUpdateNotificationTokenUseCase(
      api,
      currentUser.then((user) => user?.email),
      deviceId,
      token,
      debugStatusNotifier:
          ref.watch(updateNotificationTokenDebugStatusProvider.notifier),
      registerNotificationTokenEnabled:
          ref.watch(registerNotificationTokenEnabledFlag),
    );
  },
);