InkList class
The InkList is the underlying type that's used to store an instance of a list in ink. It's not used for the definition of the list, but for a list value that's stored in a variable. Somewhat confusingly, it's backed by a C# Dictionary, and has nothing to do with a C# List!
- Implemented types
Constructors
- InkList()
-
InkList.fromEntry(MapEntry<
InkListItem, int> singleElement) - InkList.fromOrigin(String singleOriginListName, Story originStory)
- InkList.fromString(String myListItem, Story originStory)
-
Converts a string to an ink list and returns for use in the story.
factory
- InkList.of(InkList otherList)
Properties
- all → InkList
-
The list of all items from the original list definition, equivalent to calling
LIST_ALL(list) in ink.
no setter
- count → int
-
no setter
-
entries
→ Iterable<
MapEntry< InkListItem, int> > -
The map entries of this.
no setteroverride
- hashCode → int
-
Return the hashcode for this object, used for comparisons and inserting into dictionaries.
no setteroverride
- inverse → InkList
-
The inverse of the list, equivalent to calling LIST_INVERSE(list) in ink
no setter
- isEmpty → bool
-
Whether there is no key/value pair in the map.
no setteroverride
- isNotEmpty → bool
-
Whether there is at least one key/value pair in the map.
no setteroverride
-
keys
→ Iterable<
InkListItem> -
The keys of this.
no setteroverride
- length → int
-
The number of key/value pairs in the map.
no setteroverride
-
maxItem
→ MapEntry<
InkListItem, int> -
Get the maximum item in the list, equivalent to calling LIST_MAX(list) in ink.
no setter
-
minItem
→ MapEntry<
InkListItem, int> -
Get the minimum item in the list, equivalent to calling LIST_MIN(list) in ink.
no setter
-
orderedItems
→ List<
MapEntry< InkListItem, int> > -
no setter
-
originNames
→ List<
String> ? -
no setter
- originOfMaxItem → ListDefinition?
-
no setter
-
origins
↔ List<
ListDefinition> ? -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
int> -
The values of this.
no setteroverride
Methods
-
addAll(
Map< InkListItem, int> other) → void -
Adds all key/value pairs of
other
to this map.override -
addEntries(
Iterable< MapEntry< newEntries) → voidInkListItem, int> > -
Adds all key/value pairs of
newEntries
to this map.override -
addItem(
dynamic item) → void -
cast<
RK, RV> () → Map< RK, RV> -
Provides a view of this map as having
RK
keys andRV
instances, if necessary.override -
clear(
) → void -
Removes all entries from the map.
override
-
contains(
InkList otherList) → bool - Returns true if the current list contains all the items that are in the list that is passed in. Equivalent to calling (list1 ? list2) in ink.
-
containsItemNamed(
String itemName) → bool - Returns true if this ink list contains an item with the given short name (ignoring the original list where it was defined).
-
containsKey(
Object? key) → bool -
Whether this map contains the given
key
.override -
containsValue(
Object? value) → bool -
Whether this map contains the given
value
.override -
forEach(
void f(InkListItem key, int value)) → void -
Applies
action
to each key/value pair of the map.override -
greaterThan(
InkList otherList) → bool - Returns true if all the item values in the current list are greater than all the item values in the passed in list. Equivalent to calling (list1 > list2) in ink.
-
greaterThanOrEquals(
InkList otherList) → bool - Returns true if the item values in the current list overlap or are all greater than the item values in the passed in list. None of the item values in the current list must fall below the item values in the passed in list. Equivalent to (list1 >= list2) in ink, or LIST_MIN(list1) >= LIST_MIN(list2) && LIST_MAX(list1) >= LIST_MAX(list2).
-
intersect(
InkList otherList) → InkList - Returns a new list that is the intersection of the current list with another list that's passed in - i.e. a list of the items that are shared between the two other lists. Equivalent to calling (list1 ^ list2) in ink.
-
lessThan(
InkList otherList) → bool - Returns true if all the item values in the current list are less than all the item values in the passed in list. Equivalent to calling (list1 < list2) in ink.
-
lessThanOrEquals(
InkList otherList) → bool - Returns true if the item values in the current list overlap or are all less than the item values in the passed in list. None of the item values in the current list must go above the item values in the passed in list. Equivalent to (list1 <= list2) in ink, or LIST_MAX(list1) <= LIST_MAX(list2) && LIST_MIN(list1) <= LIST_MIN(list2).
-
listWithSubRange(
dynamic minBound, dynamic maxBound) → InkList - Returns a sublist with the elements given the minimum and maxmimum bounds. The bounds can either be ints which are indices into the entire (sorted) list, or they can be InkLists themselves. These are intended to be single-item lists so you can specify the upper and lower bounds. If you pass in multi-item lists, it'll use the minimum and maximum items in those lists respectively. WARNING: Calling this method requires a full sort of all the elements in the list.
-
map<
K2, V2> (MapEntry< K2, V2> f(InkListItem key, int value)) → Map<K2, V2> -
Returns a new map where all entries of this map are transformed by
the given
convert
function.override -
maxAsList(
) → InkList -
MinAsList(
) → InkList -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
putIfAbsent(
InkListItem key, int ifAbsent()) → int -
Look up the value of
key
, or add a new entry if it isn't there.override -
remove(
Object? key) → int? -
Removes
key
and its associated value, if present, from the map.override -
removeWhere(
bool predicate(InkListItem key, int value)) → void -
Removes all entries of this map that satisfy the given
test
.override -
setInitialOriginName(
String value) → void -
setInitialOriginNames(
List< String> ? value) → void -
toString(
) → String -
Returns a string in the form "a, b, c" with the names of the items in the list, without
the origin list definition names. Equivalent to writing {list} in ink.
override
-
union(
InkList otherList) → InkList - Returns a new list that is the combination of the current list and one that's passed in. Equivalent to calling (list1 + list2) in ink.
-
update(
InkListItem key, int update(int value), {int ifAbsent()?}) → int -
Updates the value for the provided
key
.override -
updateAll(
int update(InkListItem key, int value)) → void -
Updates all values.
override
-
without(
InkList listToRemove) → InkList - Returns a new list that's the same as the current one, except with the given items removed that are in the passed in list. Equivalent to calling (list1 - list2) in ink.
Operators
-
operator ==(
Object other) → bool -
Returns true if the passed object is also an ink list that contains
the same items as the current list, false otherwise.
override
-
operator [](
Object? key) → int? -
The value for the given
key
, ornull
ifkey
is not in the map.override -
operator []=(
InkListItem key, int value) → void -
Associates the
key
with the givenvalue
.override