trace method
Implementation
@override
Stream<TracerouteStep> trace(TracerouteArgs args) {
final queue = Queue();
final stream = traceEventChannel.receiveBroadcastStream();
Future.delayed(Duration.zero).then((value) {
methodChannel.invokeMethod<void>(traceMethodName, {
'host': args.host,
'ttl': args.ttl,
});
});
return stream.transform<TracerouteStep>(
StreamTransformer<dynamic, TracerouteStep>.fromHandlers(
handleData: (data, sink) async {
if (data is Map) {
data = Map<String, dynamic>.from(data);
}
queue.add(() async {
final step = await tracestepTransformer.transform(args.host, data);
if (step != null) {
sink.add(step);
}
});
},
),
);
}