Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss: Minimize Observable interface into... #10

Open
matanlurey opened this issue Nov 17, 2016 · 8 comments
Open

Discuss: Minimize Observable interface into... #10

matanlurey opened this issue Nov 17, 2016 · 8 comments
Assignees

Comments

@matanlurey
Copy link
Member

/// Represents an object with observable state or properties.
///
/// The interface does not require any specific technique to implement
/// observability. You may implement it in the following ways:
///
/// - Extend or mixin [ObservableChangeNotifier] or [ObservableStateNotifier]
/// - Implement the interface yourself and provide your own implementation
abstract class Observable<C extends ChangeRecord> {
  /// Emits a list of changes when the state of the object changes.
  ///
  /// Changes should produced in order, if significant.
  Stream<List<C>> get changes;
}
@natebosch
Copy link
Member

+1 on having an interface designed for consumers rather than implementors. My first exposure to Observable (on both sides) had a steep learning curve because of the large surface area.

I'm less sure about the consequences of making it generic. Should we separate those discussions?

@jmesserly
Copy link

love it!

@matanlurey
Copy link
Member Author

Sure we can split into sub-issues.

Intended generic use:

abstract class ObservableList<T> implements List<T>, Observable<ListChangeRecord<T>>> {}

Instead of the current:

abstract class ObservableList<T> implements Observable {
  // Let us be honest, if you are listening to an observable list, you want this one.
  Stream<List<ListChangeRecord<T>> get listChanges;
}

@natebosch
Copy link
Member

You've convinced me on the generic argument as well 😃

@matanlurey
Copy link
Member Author

I'm closing based on this already being underway.

@jmesserly
Copy link

YAY!

@jonaird
Copy link

jonaird commented Apr 20, 2020

I'm closing based on this already being underway.

Underway?

@markegli markegli assigned markegli and unassigned matanlurey Sep 14, 2020
@markegli
Copy link
Collaborator

Reopening and assigning to myself since these changes were reverted in 0.21.0 when the package was migrated to Dart 2.

@markegli markegli reopened this Sep 14, 2020
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

No branches or pull requests

5 participants