selectable_items

Last updated:

0 purchases

selectable_items Image
selectable_items Images
Add to Cart

Description:

selectable items

selectable_items is the package that provides the type SelectableItems, which encapsulates a list of items and a selected one. Note that it is immutable.
Features #
N / A
Getting started #
This package depends on the freezed and freezed_annotation package.
Usage #
Initialize #
final selectedItems = SelectableItems(
currentIndex: 0,
items: [1, 2, 3, 4, 5],
)
copied to clipboard
Get the current item #
print(selectableItems.currentItem); // 1
copied to clipboard
Selects an item #
final newSelectedItems = selectedItems.selectItem(2);
print(newSelectedItems.currentItem); // 3
copied to clipboard
Inserts an item #
By default, insertItem inserts an item to the end of the list and set the current item index to the end of list. When given an index, it inserts the item to the specified index and sets the current item index to the given index.
final newSelectedItems = selectedItems.insertItem(10);
print(newSelectedItems.items); // [1, 2, 3, 4, 5, 10]
print(newSelectedItems.currentItem); // 10
copied to clipboard
Deletes an item #
Deletes the item at the specified index.
final newSelectedItems = selectedItems.deleteItem(2);
print(newselectedItems.items); // [1, 2, 4, 5];
print(newSelectedItems.currentItem); // 2
copied to clipboard
Modifies an item #
final newSelectedItems = selectedItems.modifyItem(0, 10);
print(newselectedItems.items); // [10, 2, 3, 4, 5];
print(newSelectedItems.currentItem); // 10
copied to clipboard
Additional information #
N/A

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.