part of ChattyWorker;

_workerStarter(message) {
  message[0].startWorking(message[1]);
}

abstract class Boss {

  ReceivePort response;
  SendPort request;

  Boss() {
    response = new ReceivePort();
    response.listen((message) {
      if (message is SendPort) {
        request = message;
        speak(Status.READY);
      } else {
        manage(message);
      }
    });
  }

  void doYourJob(Worker worker) {
    Isolate.spawn(_workerStarter, [worker, response.sendPort]);
  }

  void manage(message);

  void speak(message) {
    request.send(message);
  }

  void byebye() {
    response.close();
  }

}

part of ChattyWorker;

_manager(message) {
  message[0].startWorking(message[1]);
}

abstract class Boss {

  ReceivePort response;
  SendPort request;

  Boss() {
    response = new ReceivePort();
    response.listen((message) {
      if (message is SendPort) {
        request = message;
        speak(Status.READY);
      } else {
        manage(message);
      }
    });
  }

  void doYourJob(Worker worker) {
    Isolate.spawn(_manager, [worker, response.sendPort]);
  }

  void manage(message);

  void speak(message) {
    request.send(message);
  }

  void byebye() {
    response.close();
  }

}

Revert "rename manager to workerStarter"
Revert "rename manager to workerStarter"

This reverts commit f6e51634a05181f837fef270cb0ef25580c18c4b.
