stream_transform 2.0.0-nullsafety.0 copy "stream_transform: ^2.0.0-nullsafety.0" to clipboard
stream_transform: ^2.0.0-nullsafety.0 copied to clipboard

outdated

A collection of utilities to transform and manipulate streams.

example/main.dart

// Copyright (c) 2019, 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:html';

import 'package:stream_transform/stream_transform.dart';

void main() {
  var firstInput = document.querySelector('#first_input') as InputElement;
  var secondInput = document.querySelector('#second_input') as InputElement;
  var output = document.querySelector('#output')!;

  _inputValues(firstInput)
      .combineLatest(_inputValues(secondInput),
          (first, second) => 'First: $first, Second: $second')
      .tap((v) {
    print('Saw: $v');
  }).forEach((v) {
    output.text = v;
  });
}

Stream<String?> _inputValues(InputElement element) => element.onKeyUp
    .debounce(const Duration(milliseconds: 100))
    .map((_) => element.value);
255
likes
0
pub points
99%
popularity

Publisher

verified publishertools.dart.dev

A collection of utilities to transform and manipulate streams.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on stream_transform