startSync 静态方法

void startSync(
  1. String name,
  2. {Map? arguments,
  3. Flow? flow}
)

开始一个名为 name 的同步操作。可选地接受一个 Maparguments。此片段还可以可选地与一个 Flow 事件相关联。此操作必须在返回事件队列之前完成。

实现

static void startSync(String name, {Map? arguments, Flow? flow}) {
  if (!_hasTimeline) return;
  // TODO: When NNBD is complete, delete the following line.
  ArgumentError.checkNotNull(name, 'name');
  if (!_isDartStreamEnabled()) {
    // Push a null onto the stack and return.
    _stack.add(null);
    return;
  }
  var block = new _SyncBlock._(name, _getNextTaskId(),
      arguments: arguments, flow: flow);
  _stack.add(block);
  block._startSync();
}