listener method
void
listener(
- Object? response
)
Implementation
void listener(Object? response) {
if (response is SendPort) {
serverSendPort = response;
launchCompleter!.complete();
} else if (response is int) {
reloadCompleter!.complete();
} else if (response == null) {
receivePort.close();
stopCompleter!.complete();
} else if (response is List<Object> && response.length == 2) {
var error = response[0];
var stackTrace = response[1];
if (stackTrace is StackTrace) {
if (launchCompleter != null) {
launchCompleter!.completeError(error, stackTrace);
} else if (reloadCompleter != null) {
reloadCompleter!.completeError(error, stackTrace);
} else if (stopCompleter != null) {
stopCompleter!.completeError(error, stackTrace);
} else {
Error.throwWithStackTrace(error, stackTrace);
}
} else {
throw RemoteError('$error', '$stackTrace');
}
} else if (response is MessageHubMessage) {
if (multiIsolateServer.isRunning) {
sendMessageToOtherSupervisors(response);
} else {
pendingMessageQueue.add(response);
}
} else {
// TODO(isolate): log unsupported response.
}
}