Skip to content

Commit

Permalink
update stream_transform example to package:web
Browse files Browse the repository at this point in the history
Fixes a deprecation warning from the latest SDK.
  • Loading branch information
jakemac53 authored Jan 7, 2025
2 parents 070355e + 54ba3b1 commit 2bb935f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stream_transform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
# Bump SDK for Legacy tests when changing min SDK.
sdk: [3.1, dev]
sdk: [3.4, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
Expand Down
2 changes: 2 additions & 0 deletions pkgs/stream_transform/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 2.1.2-wip

- Require Dart 3.4 or greater.

## 2.1.1

- Require Dart 3.1 or greater
Expand Down
9 changes: 4 additions & 5 deletions pkgs/stream_transform/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// 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';
import 'package:web/web.dart';

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

_inputValues(firstInput)
Expand All @@ -21,6 +20,6 @@ void main() {
});
}

Stream<String?> _inputValues(InputElement element) => element.onKeyUp
Stream<String?> _inputValues(HTMLInputElement element) => element.onKeyUp
.debounce(const Duration(milliseconds: 100))
.map((_) => element.value);
3 changes: 2 additions & 1 deletion pkgs/stream_transform/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ description: A collection of utilities to transform and manipulate streams.
repository: https://github.com/dart-lang/tools/tree/main/pkgs/stream_transform

environment:
sdk: ^3.1.0
sdk: ^3.4.0

dev_dependencies:
async: ^2.5.0
dart_flutter_team_lints: ^3.0.0
fake_async: ^1.3.0
test: ^1.16.0
web: ^1.1.0

0 comments on commit 2bb935f

Please sign in to comment.