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