refactor: update ConversationDeltaStream for stream compatibility

- Changed the `stream()` method to a public getter `stream` in the `ConversationDeltaStream` class for compatibility with StreamProvider.
- Added documentation to clarify the necessity of this change, noting the exception to the Riverpod 3 guideline against public getters on Notifiers.
- Updated the `conversationDeltaEventsProvider` to utilize the new getter, enhancing the stream delegation pattern.
This commit is contained in:
cogwheel0
2025-10-01 18:52:53 +05:30
parent f896c4543f
commit 21ef8bf68e

View File

@@ -464,8 +464,11 @@ class ConversationDeltaStream extends _$ConversationDeltaStream {
} }
/// Provides direct access to the underlying stream. /// Provides direct access to the underlying stream.
/// Exposed as a method to avoid property-based lint violations. /// Note: This getter is necessary for compatibility with StreamProvider.
Stream<ConversationDelta> stream() => /// While Riverpod 3 discourages public getters on Notifiers, this is a
/// pragmatic exception for stream delegation patterns.
// ignore: avoid_public_notifier_properties
Stream<ConversationDelta> get stream =>
_controller?.stream ?? const Stream<ConversationDelta>.empty(); _controller?.stream ?? const Stream<ConversationDelta>.empty();
} }
@@ -477,7 +480,7 @@ final conversationDeltaEventsProvider =
final notifier = ref.watch( final notifier = ref.watch(
conversationDeltaStreamProvider(request).notifier, conversationDeltaStreamProvider(request).notifier,
); );
return notifier.stream(); return notifier.stream;
}); });
// Attachment upload queue provider // Attachment upload queue provider