Groups
Sign in
Groups
Dart Web Development
Conversations
About
Send feedback
Help
[AngularDart] Replacement to deprecated Stream functions from Tutorial?
50 views
Skip to first unread message
Rookie C
unread,
Mar 21, 2021, 10:49:23 AM
3/21/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dart Web Development
In this tutorial:
https://angulardart.dev/tutorial/toh-pt6#herosearchcomponent
A couple of deprecated functions are used:
(1) debounce()
from package:stream_transform/src/rate_limit.dart
(2) switchMap()
from package:stream_transform/src/switch.dart
So, the following function (in tutorial) does not work any more:
////////////////////////////////////////////////////////////
void ngOnInit() async {
heroes = _searchTerms.stream
.transform(debounce(Duration(milliseconds: 300)))
.distinct()
.transform(switchMap((term) => term.isEmpty
? Stream<List<Hero>>.fromIterable([<Hero>[]])
: _heroSearchService.search(term).asStream()))
.handleError((e) {
print(e);
});
}
////////////////////////////////////////////////////////////
How to make the tutorial app work again?
Rookie C
unread,
Mar 21, 2021, 11:24:57 AM
3/21/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dart Web Development, Rookie C
Found the answer.
Simply remove the "transform" part.
Reply all
Reply to author
Forward
0 new messages