listen method

void listen()

Implementation

void listen() async {
  worker.onMessage.listen((event) {
    LinkedHashMap<dynamic, dynamic> data = event.data;
    var completer = completers[data['id']];
    if (completer == null) {
      return;
    }
    if (data['error'] != null && data['error'] != "") {
      completer.completeError(data['error']);
    } else {
      completer.complete(data['response']);
    }
    completers.remove(data['id']);
  });
}