Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Style tweaks in stream_queue.dart #167

Merged
merged 3 commits into from
Apr 21, 2021
Merged

Style tweaks in stream_queue.dart #167

merged 3 commits into from
Apr 21, 2021

Conversation

natebosch
Copy link
Contributor

  • Use a noun phrase to document the hasNext getter. The next and
    peek getters keep their verb phrase doc comments since the side
    effects are critical distinctions between these methods. If we were
    writing this today, next() would be a method.
  • Change _failClosed() which returns an error, to _checkClosed()
    which checks the condition and optionally closes. Avoid nesting the
    majority of method behavior in a conditional.
  • Use RangeError.checkNotNegative over a conditional.
  • Change bare Future to Future<void> in code examples.
  • Make withTransaction async since there is no longer a blocker now
    that async methods start running synchronously.

- Use a noun phrase to document the `hasNext` getter. The `next` and
  `peek` getters keep their verb phrase doc comments since the side
  effects are critical distinctions between these methods. If we were
  writing this today, `next()` would be a method.
- Change `_failClosed()` which returns an error, to `_checkClosed()`
  which checks the condition and optionally closes. Avoid nesting the
  majority of method behavior in a conditional.
- Use `RangeError.checkNotNegative` over a conditional.
- Change bare `Future` to `Future<void>` in code examples.
- Make `withTransaction` `async` since there is no longer a blocker now
  that async methods start running synchronously.
@natebosch natebosch requested a review from jakemac53 April 21, 2021 00:48
@google-cla google-cla bot added the cla: yes label Apr 21, 2021
lib/src/stream_queue.dart Outdated Show resolved Hide resolved
lib/src/stream_queue.dart Outdated Show resolved Hide resolved
@natebosch natebosch merged commit 18dfa91 into master Apr 21, 2021
@natebosch natebosch deleted the stream-queue-style branch April 21, 2021 15:50
mosuem pushed a commit to dart-lang/core that referenced this pull request Oct 14, 2024
- Use a noun phrase to document the `hasNext` getter. The `next` and
  `peek` getters keep their verb phrase doc comments since the side
  effects are critical distinctions between these methods. If we were
  writing this today, `next()` would be a method.
- Change `_failClosed()` which returns an error, to `_checkNotClosed()`
  which checks the condition and optionally closes. Avoid nesting the
  majority of method behavior in a conditional.
- Use `RangeError.checkNotNegative` over a conditional.
- Change bare `Future` to `Future<void>` in code examples.
- Make `withTransaction` `async` since there is no longer a blocker now
  that async methods start running synchronously.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

2 participants