readAll method

  1. @override
void readAll()
override

Implementation

@override
void readAll() async {
  if (currentServerNotificationData == null) return;
  await notificationCenterDataSource.readAll();
  final oldResponse = currentServerNotificationData!.data;
  final newData = oldResponse.data
      .map((element) => element.copyWith(readAt: DateTime.now()))
      .toList();
  final newResponse = oldResponse.copyWith(data: newData);
  final newServerNotificationData = ServerNotificationData(
    type: SeverNotificationChangedType.loaded,
    data: newResponse,
  );
  serverNotificationStreamController.add(newServerNotificationData);
  currentServerNotificationData = newServerNotificationData;
}