Skip to content

Conversation

hoc081098
Copy link
Collaborator

@hoc081098 hoc081098 commented Feb 2, 2025

This pull request includes significant updates to the examples/flutter/github_search and packages/rxdart directories, focusing on stream handling and improving the ValueStream functionality. The most important changes include updating dependencies, modifying stream classes and widgets, and adding new properties to enhance stream behavior.

Updates to examples/flutter/github_search:

Enhancements to packages/rxdart:

Improvements to packages/rxdart_flutter:

Additional changes:

…eplayValueStream

# Conflicts:
#	examples/flutter/github_search/lib/search_screen.dart
#	examples/flutter/github_search/pubspec.lock
@hoc081098 hoc081098 self-assigned this Feb 2, 2025
@hoc081098 hoc081098 marked this pull request as ready for review February 2, 2025 07:39
@hoc081098 hoc081098 marked this pull request as draft February 2, 2025 07:42
@hoc081098 hoc081098 requested a review from Copilot September 27, 2025 08:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces the isReplayValueStream property to the ValueStream interface to indicate whether a stream replays its last emitted event to new subscribers. This enables more flexible stream handling and allows Flutter widgets to dynamically determine stream behavior instead of relying on hardcoded defaults.

  • Adds isReplayValueStream property to ValueStream interface and implementations
  • Updates Flutter widgets to use the new property instead of hardcoded true defaults
  • Refactors example app to use updated RxDart API

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/rxdart/lib/src/streams/value_stream.dart Adds isReplayValueStream property to ValueStream interface
packages/rxdart/lib/src/subjects/behavior_subject.dart Implements isReplayValueStream in BehaviorSubject classes
packages/rxdart/lib/src/streams/connectable_stream.dart Implements isReplayValueStream in ValueConnectableStream
packages/rxdart_flutter/lib/src/value_stream_*.dart Updates Flutter widgets to use dynamic stream property
packages/rxdart_flutter/test/src/rxdart_ext/value_subject.dart Implements property in test helper classes
examples/flutter/github_search/lib/bloc/search_bloc.dart Updates example to use new RxDart API

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 138 to +143
_ambiguate(WidgetsBinding.instance)!.addPostFrameCallback((_) {
if (widget.stream != stream) {
return;
}
_notifyListener(stream.value);
_subscribeIfNeeded(stream);
Copy link
Preview

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition uses widget.stream instead of _currentStream which could cause incorrect behavior. The condition should check if the current stream has changed since the callback was scheduled.

Suggested change
_ambiguate(WidgetsBinding.instance)!.addPostFrameCallback((_) {
if (widget.stream != stream) {
return;
}
_notifyListener(stream.value);
_subscribeIfNeeded(stream);
final scheduledStream = stream;
_ambiguate(WidgetsBinding.instance)!.addPostFrameCallback((_) {
if (widget.stream != scheduledStream) {
return;
}
_notifyListener(scheduledStream.value);
_subscribeIfNeeded(scheduledStream);

Copilot uses AI. Check for mistakes.

Comment on lines +151 to +154
void _subscribeIfNeeded(Stream<T> streamToListen) {
if (_subscription != null) {
return;
}
Copy link
Preview

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name _subscribeIfNeeded is misleading because it only checks if _subscription is null, but doesn't verify if the subscription is for the correct stream. This could lead to using an outdated subscription when the stream changes.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant