blob: e1f7137f8742efa70f95ec0b6d2f56dfa78109ad [file] [log] [blame]
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
/// Models a [Stream.map] callback as a [StreamTransformer].
///
/// This is most useful to pass to functions that take a [StreamTransformer]
/// other than [Stream.transform]. For inline uses [Stream.map] should be
/// preferred.
///
/// For example:
///
/// ```
/// final sinkMapper = new StreamSinkTransformer.fromStreamTransformer(
/// map((v) => '$v'));
/// ```
@Deprecated('This utility should not be needed with extension methods')
StreamTransformer<S, T> map<S, T>(T convert(S event)) =>
StreamTransformer.fromBind((stream) => stream.map(convert));