Created
November 4, 2014 23:26
-
-
Save alxhub/4424ad3e4aaa8a257fe7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library main; | |
import 'dart:async'; | |
void main() { | |
var zs = new ZoneSpecification(print: onPrint); | |
var zs2 = new ZoneSpecification(print: onPrint2); | |
var sc; | |
sc = new StreamController(); | |
runZoned(() { | |
print("registering"); | |
sc.stream.listen(print); | |
}, zoneSpecification: zs); | |
runZoned(() { | |
print("sending"); | |
sc.add("receiving"); | |
}, zoneSpecification: zs2); | |
} | |
onPrint(Zone self, ZoneDelegate parent, Zone zone, String line) { | |
parent.print(zone, "[inZone] $line"); | |
} | |
onPrint2(Zone self, ZoneDelegate parent, Zone zone, String line) { | |
parent.print(zone, "[inZone2] $line"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment