createSession method

Future<WorkerSession> createSession([
  1. dynamic initial
])

Implementation

Future<WorkerSession> createSession([dynamic initial]) async {
  var s = generateBasicId(length: 25);
  var session = _WorkerSession(this, s, true, initial);
  _sendPort.send(<String, dynamic>{
    't': 'session.created',
    's': s,
    'n': initial,
  });
  await ((_sessionReady[s] = Completer<void>.sync()).future);
  _ourSessions[s] = session;
  return session;
}