双向链表节点对象,你需要继承此类才能在 ElLinkedList 中使用:
class _Node extends ElLinkedNode<_Node> {}
void main() {
final list = ElLinkedList<_Node>();
list.add(_Node());
}
或者使用 mixin 混入:
// 扩展链表类(可选)
class _LinkedList<D> extends ElLinkedList<_Node<D>> {}
class _Node<D> with ElLinkedNode<_Node<D>> {
_Node(this.data);
D data; // 添加数据
}
void main() {
final list = _LinkedList<int>(); // 子节点必须设置 int 类型数据
list.add(_Node(1));
list.add(_Node(2));
}
Constructors
Properties
- debugLabel → String
-
调试标签
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
list
→ ElLinkedList<
N> -
访问当前节点所在的链表
no setter
- mounted → bool
-
当前节点是否处于挂载中,当一个节点对象已经挂载,就不能再继续插入,
除非先解除当前关联,才可以将节点重新插入到链表中
no setter
- next → N?
-
下一个节点
no setter
- prev → N?
-
上一个节点
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
mount(
ElLinkedList< N> list, N? prev, N? next) → void - 当节点被关联时调用
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
unmount(
) → void - 当节点被移除时调用
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited