addListener method Null safety

void addListener(
  1. MiniSubscription<T> data
)

Inserts data at the end of the list.

Implementation

void addListener(MiniSubscription<T> data) {
  var newNode = Node(data: data);

  if (isEmpty) {
    _head = newNode;
  } else {
    var currentNode = _head!;
    while (currentNode.next != null) {
      currentNode = currentNode.next!;
    }
    currentNode.next = newNode;
  }
}