TimelineTask.withTaskId constructor Null safety

TimelineTask.withTaskId(
  1. int taskId,
  2. {String? filterKey}
)

Create a task with an explicit taskId. This is useful if you are passing a task from one isolate to another.

Important note: only provide task IDs which have been obtained as a result of invoking TimelineTask.pass. Specifying a custom ID can lead to ID collisions, resulting in incorrect rendering of timeline events.

If filterKey is provided, a property named filterKey will be inserted into the arguments of each event associated with this task. The filterKey will be set to the value of filterKey.

Implementation

TimelineTask.withTaskId(int taskId, {String? filterKey})
    : _parent = null,
      _filterKey = filterKey,
      _taskId = taskId {
  // TODO: When NNBD is complete, delete the following line.
  ArgumentError.checkNotNull(taskId, 'taskId');
}