-
Notifications
You must be signed in to change notification settings - Fork 24
Adding package:listen #898
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
base: main
Are you sure you want to change the base?
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers
|
Files |
---|
pkgs/listen/lib/listen.dart |
pkgs/listen/test/listen_test.dart |
pkgs/listen/test/test_listenable.dart |
All source files should start with a license header.
This check can be disabled by tagging the PR with skip-license-check
.
/// notifications whenever any of a list of other [Listenable]s trigger their | ||
/// notifications. | ||
abstract class Listenable { | ||
/// Abstract const constructor. This constructor enables subclasses to provide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not abstract. Just "Const constructor".
/// const constructors so that they can be used in const expressions. | ||
const Listenable(); | ||
|
||
/// Return a [Listenable] that triggers when any of the given [Listenable]s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Return" -> "Creates"
/// | ||
/// Once the factory is called, items must not be added or removed from the | ||
/// iterable. | ||
/// Doing so will lead to memory leaks or exceptions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That's a bad API. If the class plans to iterate the argument more than once, it should copy it, or request a List
. Allowing an Iterable
means you can get a lazily computed collection, and if you iterate it more than once, that's going to be even more expensive than just copying to a list once and for all.)
/// iterable. | ||
/// Doing so will lead to memory leaks or exceptions. | ||
/// | ||
/// The iterable may contain nulls; they are ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really not great API to allowing null
if you don't use it. (A left-over from NNBD conversion?)
/// | ||
/// See also: | ||
/// | ||
/// * [AnimatedBuilder], a widget that uses a builder callback to rebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that class in scope? Same for ValueListenableBuilder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! This is a draft PR. These will need to be cleaned up!
factory Listenable.merge(Iterable<Listenable?> listenables) = | ||
_MergingListenable; | ||
|
||
/// Register a closure to be called when the object notifies its listeners. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Registers", and "Removes" below. Check using third person present tense everywhere.
Towards flutter/flutter#171101