Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 5c50493

Browse files
authored
Drop fromBind utility (#59)
Replace with `StreamTransformer.fromBind` which is now in the SDK.
1 parent a297a97 commit 5c50493

File tree

6 files changed

+7
-34
lines changed

6 files changed

+7
-34
lines changed

lib/src/bind.dart

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/src/chain_transformers.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import 'dart:async';
66

7-
import 'bind.dart';
8-
97
/// Combines two transformers into one.
108
///
119
/// This is most useful to keep a reference to the combination and use it in
@@ -21,4 +19,5 @@ import 'bind.dart';
2119
/// ```
2220
StreamTransformer<S, T> chainTransformers<S, I, T>(
2321
StreamTransformer<S, I> first, StreamTransformer<I, T> second) =>
24-
fromBind((values) => values.transform(first).transform(second));
22+
StreamTransformer.fromBind(
23+
(values) => values.transform(first).transform(second));

lib/src/map.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import 'dart:async';
66

7-
import 'bind.dart';
8-
97
/// Models a [Stream.map] callback as a [StreamTransformer].
108
///
119
/// This is most useful to pass to functions that take a [StreamTransformer]
@@ -19,4 +17,4 @@ import 'bind.dart';
1917
/// map((v) => '$v'));
2018
/// ```
2119
StreamTransformer<S, T> map<S, T>(T convert(S event)) =>
22-
fromBind((stream) => stream.map(convert));
20+
StreamTransformer.fromBind((stream) => stream.map(convert));

lib/src/scan.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4-
import 'dart:async';
54

6-
import 'bind.dart';
5+
import 'dart:async';
76

87
/// Scan is like fold, but instead of producing a single value it yields
98
/// each intermediate accumulation.
109
StreamTransformer<S, T> scan<S, T>(
1110
T initialValue, T combine(T previousValue, S element)) =>
12-
fromBind((stream) {
11+
StreamTransformer.fromBind((stream) {
1312
var accumulated = initialValue;
1413
return stream.map((value) => accumulated = combine(accumulated, value));
1514
});

lib/src/start_with.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'dart:async';
66

7-
import 'bind.dart';
87
import 'followed_by.dart';
98

109
/// Emits [initial] before any values from the original stream.
@@ -27,7 +26,7 @@ StreamTransformer<T, T> startWithMany<T>(Iterable<T> initial) =>
2726
/// the original stream is a broadcast stream it will miss any events which
2827
/// occur before [initial] closes.
2928
StreamTransformer<T, T> startWithStream<T>(Stream<T> initial) =>
30-
fromBind((values) {
29+
StreamTransformer.fromBind((values) {
3130
if (values.isBroadcast && !initial.isBroadcast) {
3231
initial = initial.asBroadcastStream();
3332
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ homepage: https://www.github.com/dart-lang/stream_transform
55
version: 0.0.15-dev
66

77
environment:
8-
sdk: ">=2.0.0 <3.0.0"
8+
sdk: ">=2.1.0 <3.0.0"
99

1010
dev_dependencies:
1111
test: ^1.0.0

0 commit comments

Comments
 (0)