ZoneSpecification.from 构造函数

ZoneSpecification.from(
  1. ZoneSpecification other,
  2. {HandleUncaughtErrorHandler? handleUncaughtError,
  3. RunHandler? run,
  4. RunUnaryHandler? runUnary,
  5. RunBinaryHandler? runBinary,
  6. RegisterCallbackHandler? registerCallback,
  7. RegisterUnaryCallbackHandler? registerUnaryCallback,
  8. RegisterBinaryCallbackHandler? registerBinaryCallback,
  9. ErrorCallbackHandler? errorCallback,
  10. ScheduleMicrotaskHandler? scheduleMicrotask,
  11. CreateTimerHandler? createTimer,
  12. CreatePeriodicTimerHandler? createPeriodicTimer,
  13. PrintHandler? print,
  14. ForkHandler? fork}
)

other 和提供的处理程序创建一个规范。

创建的区域规范具有 other 中的处理程序以及任何单独提供的处理程序。如果通过 other 和个别提供处理程序,则个别提供的处理程序将覆盖来自 other 的处理程序。

实现

factory ZoneSpecification.from(ZoneSpecification other,
    {HandleUncaughtErrorHandler? handleUncaughtError,
    RunHandler? run,
    RunUnaryHandler? runUnary,
    RunBinaryHandler? runBinary,
    RegisterCallbackHandler? registerCallback,
    RegisterUnaryCallbackHandler? registerUnaryCallback,
    RegisterBinaryCallbackHandler? registerBinaryCallback,
    ErrorCallbackHandler? errorCallback,
    ScheduleMicrotaskHandler? scheduleMicrotask,
    CreateTimerHandler? createTimer,
    CreatePeriodicTimerHandler? createPeriodicTimer,
    PrintHandler? print,
    ForkHandler? fork}) {
  return ZoneSpecification(
      handleUncaughtError: handleUncaughtError ?? other.handleUncaughtError,
      run: run ?? other.run,
      runUnary: runUnary ?? other.runUnary,
      runBinary: runBinary ?? other.runBinary,
      registerCallback: registerCallback ?? other.registerCallback,
      registerUnaryCallback:
          registerUnaryCallback ?? other.registerUnaryCallback,
      registerBinaryCallback:
          registerBinaryCallback ?? other.registerBinaryCallback,
      errorCallback: errorCallback ?? other.errorCallback,
      scheduleMicrotask: scheduleMicrotask ?? other.scheduleMicrotask,
      createTimer: createTimer ?? other.createTimer,
      createPeriodicTimer: createPeriodicTimer ?? other.createPeriodicTimer,
      print: print ?? other.print,
      fork: fork ?? other.fork);
}