list<T> static method
Creates a ListBeacon with an initial list value.
This beacon manages a list of items, allowing for reactive updates and manipulations of the list.
The ListBeacon provides methods to add, remove, and update items in the list in a way that can be
observed by listeners. This is useful for managing collections of data that need to be dynamically
updated and tracked in an application.
Example:
var nums = Beacon.list<int>([1, 2, 3]);
Beacon.createEffect(() {
print(nums.value); // Outputs: [1, 2, 3]
});
nums.add(4); // Outputs: [1, 2, 3, 4]
nums.remove(2); // Outputs: [1, 3, 4]
Implementation
static ListBeacon<T> list<T>([List<T>? initialValue]) =>
ListBeacon<T>(initialValue ?? []);