A Property from scan
tosh opened this issue · comments
Thomas Schranz commented
In the example code below I was trying to produce a Property
which represents a click counter of a button.
But upon loading the page in Dartium using chrome dev editor I get the following error. Not sure what I'm doing wrong here, anyone knows?
Exception: Class '_ScanReactable' has no instance method 'asBroadcastStream'.
NoSuchMethodError: method not found: 'asBroadcastStream'
Receiver: Instance of '_ScanReactable'
Arguments: [onCancel: null, onListen: null]
package:frappe/src/event_stream.dart:55
import 'dart:html';
import 'package:frappe/frappe.dart';
void main() {
EventStream clickStream = new EventStream(querySelector('.frp button').onClick)
.map((event) => 1);
window.console.log(clickStream);
Property count = clickStream.scan(0, combine);
count.listen((event) => window.console.log(event));
}
int combine(int x, int y) {
return x + y;
}
I'm using frappe: ">=0.3.0+1 <0.4.0"
in the pubspec and DartiumVersion 37.0.2062.0 (291930)
Dan Schultz commented
Definitely a bug. You can use .asStream().asBroadcastStream()
as a workaround.
Dan Schultz commented
Should be fixed now. Thanks for the report!