### int indexWhere(bool test(E), [int start = 0]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/indexWhere.html Returns the first index in the list that satisfies the provided test function. The search starts at the index specified by start, which defaults to 0. ```APIDOC ## indexWhere ### Description Returns the first index in the list that satisfies the provided test function. If no element satisfies the test, returns -1. ### Signature `int indexWhere(bool test(E), [int start = 0])` ### Parameters - **test** (bool Function(E)) - Required - A function that tests each element of the list. - **start** (int) - Optional - The index to start searching from. Defaults to 0. ``` -------------------------------- ### Summing elements with reduce Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/reduce.html Example demonstrating how to calculate the sum of a list of doubles using reduce. ```dart final numbers = [10, 2, 5, 0.5]; final result = numbers.reduce((value, element) => value + element); print(result); // 17.5 ``` -------------------------------- ### Configure MapBuilder with custom base Source: https://pub.dev/documentation/built_collection/latest/built_collection/MapBuilder/withBase.html Examples of using withBase to set a SplayTreeMap for ordered iteration or a LinkedHashMap with custom equality logic. ```dart // Iterates over elements in ascending order. new MapBuilder() ..withBase(() => new SplayTreeMap()); // Uses custom equality. new MapBuilder() ..withBase(() => new LinkedHashMap( equals: (int a, int b) => a % 255 == b % 255, hashCode: (int n) => (n % 255).hashCode)); ``` -------------------------------- ### int indexOf(E element, [int start = 0]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/indexOf.html Returns the first index of the specified element in the list. The search begins at the provided start index, which defaults to 0. ```APIDOC ## int indexOf(E element, [int start = 0]) ### Description Returns the first index of the specified element in the BuiltList. The search starts at the index provided by the optional `start` parameter. ### Parameters - **element** (E) - Required - The element to search for in the list. - **start** (int) - Optional - The index to start the search from. Defaults to 0. ### Returns - **int** - The index of the first occurrence of the element, or -1 if the element is not found. ``` -------------------------------- ### Configuring SetBuilder with custom base implementations Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/withBase.html Examples of using withBase to set a SplayTreeSet or a LinkedHashSet with custom equality logic. ```dart // Iterates over elements in ascending order. new SetBuilder()..withBase(() => new SplayTreeSet()); // Uses custom equality. new SetBuilder()..withBase(() => new LinkedHashSet( equals: (int a, int b) => a % 255 == b % 255, hashCode: (int n) => (n % 255).hashCode)); ``` -------------------------------- ### get first Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/first.html Retrieves the first element of the list. ```APIDOC ## E get first ### Description Returns the first element of the list, equivalent to List.first. ### Signature `E get first` ``` -------------------------------- ### BuiltList sublist(int start, [int? end]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/sublist.html Returns a new BuiltList containing the elements from start to end. ```APIDOC ## BuiltList sublist(int start, [int? end]) ### Description Returns a new `BuiltList` containing the elements from the specified `start` index to the `end` index. This method behaves similarly to the standard `List.sublist` method but returns a `BuiltList` instance. ### Parameters - **start** (int) - Required - The starting index of the sublist. - **end** (int?) - Optional - The ending index of the sublist. If omitted, the sublist extends to the end of the list. ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/length.html Returns the number of elements in the BuiltList. ```APIDOC ## int get length ### Description Returns the number of elements currently stored in the BuiltList. This property overrides the standard List.length getter. ### Signature `int get length` ### Returns - **int** - The count of elements in the collection. ``` -------------------------------- ### int lastIndexOf(E element, [int? start]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/lastIndexOf.html Searches the list for the specified element, starting from the end and moving backwards. Optionally accepts a start index to begin the search. ```APIDOC ## lastIndexOf(E element, [int? start]) ### Description Returns the last index of the specified element in the list. If a start index is provided, the search begins at that index and moves backwards. ### Parameters - **element** (E) - Required - The element to search for. - **start** (int?) - Optional - The index to start the search from, moving backwards. ``` -------------------------------- ### Summing elements with fold Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/fold.html Example demonstrating how to calculate the sum of a list of doubles using an initial value. ```dart final numbers = [10, 2, 5, 0.5]; const initialValue = 100.0; final result = numbers.fold( initialValue, (previousValue, element) => previousValue + element); print(result); // 117.5 ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/length.html Retrieves the number of elements in the SetBuilder. ```APIDOC ## int get length ### Description Returns the number of elements in the SetBuilder. This property behaves identically to the standard Set.length property. ### Signature `int get length` ### Returns - **int** - The count of elements in the set. ``` -------------------------------- ### bool get isEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/isEmpty.html Returns true if the collection is empty, false otherwise. ```APIDOC ## bool get isEmpty ### Description Returns true if the collection contains no elements. This property behaves identically to the standard List.isEmpty property. ### Signature `bool get isEmpty` ### Returns - **bool** - True if the list is empty, false if it contains elements. ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/MapBuilder/length.html Returns the number of entries in the MapBuilder. ```APIDOC ## int get length ### Description Returns the number of key-value pairs in the MapBuilder. This property behaves exactly like the standard Dart Map.length property. ### Signature `int get length` ### Returns - **int** - The count of entries in the map. ``` -------------------------------- ### E get first Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/first.html Returns the first element in the iteration order of the BuiltSet. Throws a StateError if the set is empty. ```APIDOC ## E get first ### Description Returns the first element in the iteration order of the BuiltSet. This is equivalent to calling `elementAt(0)`. ### Behavior - Returns the first element if the collection is not empty. - Throws a `StateError` if the collection is empty. ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMap/length.html Returns the number of entries in the BuiltMap. ```APIDOC ## int get length ### Description Returns the number of key-value pairs in the BuiltMap. This property behaves exactly like the standard Dart Map.length property. ### Signature `int get length` ### Returns - **int**: The count of entries in the map. ``` -------------------------------- ### bool get isEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMap/isEmpty.html Returns true if there are no key-value pairs in the map. ```APIDOC ## bool get isEmpty ### Description Returns true if the map has no entries. This property behaves identically to the standard Dart Map.isEmpty property. ### Return Value - **bool** - True if the map is empty, false otherwise. ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/length.html Returns the number of elements in the BuiltSet. ```APIDOC ## int get length ### Description Returns the number of elements in the BuiltSet. This property overrides the standard Set.length getter. ### Signature `int get length` ### Returns - **int** - The count of elements in the set. ``` -------------------------------- ### bool get isEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/isEmpty.html Returns true if the multimap is empty, false otherwise. ```APIDOC ## bool get isEmpty ### Description Returns true if the BuiltListMultimap contains no key-value pairs. This property behaves identically to ListMultimap.isEmpty. ### Signature `bool get isEmpty` ### Returns - **bool** - True if the collection is empty, false if it contains at least one entry. ``` -------------------------------- ### void sublist(int start, [int? end]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/sublist.html Updates the builder in place by extracting a sublist from the current list. This method does not return a value. ```APIDOC ## void sublist(int start, [int? end]) ### Description Updates the builder in place by creating a sublist from the existing list, similar to the standard List.sublist method. This method returns nothing. ### Parameters - **start** (int) - Required - The starting index of the sublist. - **end** (int?) - Optional - The ending index of the sublist. ``` -------------------------------- ### bool get isEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/isEmpty.html Returns true if the set contains no elements, false otherwise. ```APIDOC ## bool get isEmpty ### Description Returns a boolean value indicating whether the set is empty. This property behaves identically to the standard Dart Set.isEmpty property. ### Signature `bool get isEmpty` ### Returns - **bool** - True if the set contains no elements, false if it contains one or more elements. ``` -------------------------------- ### bool get isNotEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/isNotEmpty.html Returns true if the list is not empty, false otherwise. ```APIDOC ## bool get isNotEmpty ### Description Returns a boolean value indicating whether the list contains any elements. This property behaves identically to the standard List.isNotEmpty property. ### Signature `bool get isNotEmpty` ### Returns - **bool** - True if the list has at least one element, false if it is empty. ``` -------------------------------- ### getRange(int start, int end) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/getRange.html Returns an Iterable of elements from the BuiltList starting at the 'start' index (inclusive) and ending at the 'end' index (exclusive). ```APIDOC ## getRange(int start, int end) ### Description Returns an Iterable of elements from the BuiltList within the specified range. This method behaves identically to the standard List.getRange method. ### Signature Iterable getRange(int start, int end) ### Parameters - **start** (int) - The starting index (inclusive) of the range. - **end** (int) - The ending index (exclusive) of the range. ### Returns - **Iterable** - An Iterable containing the elements from the specified range. ``` -------------------------------- ### Using the take method Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/take.html Demonstrates how to limit the number of elements retrieved from a list and handling cases where the requested count exceeds the list size. ```dart final numbers = [1, 2, 3, 5, 6, 7]; final result = numbers.take(4); // (1, 2, 3, 5) final takeAll = numbers.take(100); // (1, 2, 3, 5, 6, 7) ``` -------------------------------- ### void forEach(void Function(E) f) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/forEach.html Invokes the provided action on each element of the BuiltList in iteration order. ```APIDOC ## void forEach(void Function(E) f) ### Description Invokes the provided action `f` on each element of this iterable in iteration order. ### Parameters - **f** (void Function(E)) - Required - The function to be called for each element in the list. ### Example ```dart final numbers = [1, 2, 6, 7]; numbers.forEach(print); // 1 // 2 // 6 // 7 ``` ``` -------------------------------- ### void removeRange(int start, int end) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/removeRange.html Removes the elements in the range [start, end) from the collection. ```APIDOC ## void removeRange(int start, int end) ### Description Removes the elements in the range [start, end) from the collection. This method behaves identically to the standard List.removeRange method. ### Parameters - **start** (int) - The starting index of the range to remove (inclusive). - **end** (int) - The ending index of the range to remove (exclusive). ``` -------------------------------- ### void fillRange(int start, int end, E fillValue) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/fillRange.html Fills the range from start (inclusive) to end (exclusive) with the specified fillValue. ```APIDOC ## void fillRange(int start, int end, E fillValue) ### Description Fills the elements of the list from index `start` (inclusive) to `end` (exclusive) with the provided `fillValue`. ### Parameters - **start** (int) - The starting index of the range to fill. - **end** (int) - The ending index of the range to fill (exclusive). - **fillValue** (E) - The value to assign to each element in the specified range. ``` -------------------------------- ### Implement toBuiltList method Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/toBuiltList.html Overrides the toBuiltList method to return the current instance as a BuiltList. ```dart @override BuiltList toBuiltList() => this; ``` -------------------------------- ### void replaceRange(int start, int end, Iterable iterable) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/replaceRange.html Replaces the elements in the range [start, end) with the elements of the provided iterable. ```APIDOC ## replaceRange(int start, int end, Iterable iterable) ### Description Replaces the elements in the range [start, end) with the elements of the provided iterable. This method behaves identically to the standard List.replaceRange method. ### Parameters - **start** (int) - The starting index of the range to replace (inclusive). - **end** (int) - The ending index of the range to replace (exclusive). - **iterable** (Iterable) - The collection of elements to insert into the specified range. ``` -------------------------------- ### first Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/first.html Returns the first element of the BuiltList. Throws a StateError if the list is empty. ```APIDOC ## E get first ### Description The first element of the list. Equivalent to `this.elementAt(0)`. ### Throws - **StateError**: If the list is empty. ``` -------------------------------- ### BuiltList toBuiltList() Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/toBuiltList.html Converts the current object to a BuiltList. ```APIDOC ## BuiltList toBuiltList() ### Description Converts the current object to a BuiltList. ### Signature `BuiltList toBuiltList()` ### Returns - **BuiltList** - A BuiltList representation of the current object. ``` -------------------------------- ### void takeWhile(bool test(E)) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/takeWhile.html Updates the builder in place by keeping elements from the start of the list as long as they satisfy the provided test predicate. ```APIDOC ## void takeWhile(bool test(E)) ### Description Updates the builder in place by taking elements from the list as long as the provided test function returns true. This method behaves similarly to Iterable.takeWhile but modifies the internal list directly. ### Parameters - **test** (bool Function(E)) - Required - A predicate function that tests each element. The method stops taking elements when this function returns false. ``` -------------------------------- ### int lastIndexWhere(bool test(E), [int? start]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/lastIndexWhere.html Returns the last index in the list that satisfies the provided predicate. The search begins at the optional start index and proceeds backwards. ```APIDOC ## lastIndexWhere ### Signature `int lastIndexWhere(bool test(E), [int? start])` ### Description Returns the index of the last element in the list that satisfies the provided `test` function. If `start` is provided, the search begins at that index and proceeds backwards. Returns -1 if no element satisfies the predicate. ### Parameters - **test** (bool Function(E)) - Required - A function that tests each element. Returns true if the element matches the criteria. - **start** (int?) - Optional - The index to start searching backwards from. Defaults to the last index of the list. ``` -------------------------------- ### void forEach(void Function(E) f) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/forEach.html Invokes the provided action on each element of the BuiltSet in iteration order. ```APIDOC ## void forEach(void Function(E) f) ### Description Invokes the provided action `f` on each element of this BuiltSet in iteration order. ### Parameters - **f** (void Function(E)) - Required - The function to be called for each element in the set. ### Example ```dart final numbers = BuiltSet([1, 2, 6, 7]); numbers.forEach(print); // 1 // 2 // 6 // 7 ``` ``` -------------------------------- ### void forEach(void Function(K, V) f) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMap/forEach.html Executes a function for each key-value pair in the map. ```APIDOC ## void forEach(void Function(K, V) f) ### Description Iterates over each key-value pair in the BuiltMap and executes the provided function `f` for each entry. This method behaves identically to the standard `Map.forEach` method. ### Parameters - **f** (void Function(K, V)) - Required - A function that takes the key and value as arguments and performs an action. ``` -------------------------------- ### get last Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/last.html Retrieves the last element of the list. ```APIDOC ## E get last ### Description Returns the last element of the list, equivalent to List.last. ### Implementation `E get last => _list.last;` ``` -------------------------------- ### Using expand to generate sequences Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/expand.html Demonstrates expanding a list of integers into a sequence of counts. ```dart Iterable count(int n) sync* { for (var i = 1; i <= n; i++) { yield i; } } var numbers = [1, 3, 0, 2]; print(numbers.expand(count)); // (1, 1, 2, 3, 1, 2) ``` -------------------------------- ### build() Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListExtension.html Converts a standard List into a BuiltList. ```APIDOC ## build() ### Description Converts the current List into a BuiltList. ### Signature `BuiltList build()` ### Usage Available on `List`, provided by the `BuiltListExtension` extension. ``` -------------------------------- ### build() Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListMultimapBuilder-class.html Converts the current builder state into an immutable BuiltListMultimap. ```APIDOC ## Method: build ### Description Finalizes the construction and returns an immutable BuiltListMultimap instance. ### Returns - **BuiltListMultimap** - The resulting immutable collection. ``` -------------------------------- ### Get last element Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/last.html Retrieves the last element of the list. ```dart E get last => _list.last; ``` -------------------------------- ### Implementation of toBuiltSet Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/toBuiltSet.html The default implementation returns the current instance as a BuiltSet. ```dart @override BuiltSet toBuiltSet() => this; ``` -------------------------------- ### Using BuiltList.any to check elements Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/any.html Demonstrates checking for elements meeting specific criteria within a BuiltList. ```dart final numbers = [1, 2, 3, 5, 6, 7]; var result = numbers.any((element) => element >= 5); // true; result = numbers.any((element) => element >= 10); // false; ``` -------------------------------- ### Implementation of take Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/take.html The internal implementation of the take method for BuiltList. ```dart @override Iterable take(int n) => _list.take(n); ``` -------------------------------- ### BuiltSet toBuiltSet() Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/toBuiltSet.html Converts the current BuiltList instance into a BuiltSet. ```APIDOC ## BuiltSet toBuiltSet() ### Description Converts the current BuiltList instance into a BuiltSet. ### Signature `BuiltSet toBuiltSet()` ### Returns - **BuiltSet** - A new BuiltSet containing the elements of the current BuiltList. ``` -------------------------------- ### Get length of SetBuilder Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/length.html Retrieves the count of elements in the underlying set. ```dart int get length => _set.length; ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSetMultimap/length.html Returns the number of keys present in the BuiltSetMultimap. ```APIDOC ## int get length ### Description Returns the total number of keys contained within the BuiltSetMultimap. This property behaves exactly as SetMultimap.length. ### Signature `int get length` ### Returns - **int**: The number of keys in the multimap. ``` -------------------------------- ### build() Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSetExtension.html Converts a standard Set to an immutable BuiltSet. ```APIDOC ## build() ### Description Converts the current Set instance into a BuiltSet. ### Signature `BuiltSet build()` ### Usage ```dart final mySet = {1, 2, 3}; final builtSet = mySet.build(); ``` ``` -------------------------------- ### Implementation of take Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/take.html The internal implementation of the take method for BuiltSet. ```dart @override Iterable take(int n) => _set.take(n); ``` -------------------------------- ### ListMultimapBuilder constructor Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListMultimapBuilder/ListMultimapBuilder.html Instantiates a new ListMultimapBuilder with optional initial elements. ```APIDOC ## ListMultimapBuilder constructor ### Description Creates a new instance of ListMultimapBuilder. The builder can be optionally initialized with elements from a Map, ListMultimap, or BuiltListMultimap. ### Signature ListMultimapBuilder([dynamic multimap = const {}]) ### Parameters - **multimap** (dynamic) - Optional - The initial data to populate the builder, which can be a Map, ListMultimap, or BuiltListMultimap. ``` -------------------------------- ### build() Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetMultimapBuilder-class.html Converts the current state of the builder into an immutable BuiltSetMultimap. ```APIDOC ## build() ### Description Finalizes the builder and returns an immutable BuiltSetMultimap containing the current elements. ### Returns - **BuiltSetMultimap** - The resulting immutable collection. ``` -------------------------------- ### List toList({bool growable = true}) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/toList.html Converts the BuiltList to a List. The implementation is efficient, returning a copy-on-write wrapper that avoids copying data unless mutations are performed. ```APIDOC ## List toList({bool growable = true}) ### Description Converts the BuiltList to a standard Dart List. This implementation is efficient as it returns a copy-on-write wrapper around the underlying data, avoiding unnecessary copies if the list is not mutated. ### Parameters - **growable** (bool) - Optional - Defaults to true. Determines if the returned list can be resized. ### Returns - **List** - A List containing the elements of the BuiltList. ``` -------------------------------- ### Get first element in ListBuilder Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/first.html Retrieves the first element of the underlying list. ```dart E get first => _list.first; ``` -------------------------------- ### bool get isNotEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/isNotEmpty.html Returns true if the multimap is not empty, false otherwise. ```APIDOC ## bool get isNotEmpty ### Description Returns true if the BuiltListMultimap contains at least one key-value pair. This property behaves identically to the standard ListMultimap.isNotEmpty property. ### Returns - **bool** - True if the collection is not empty, false if it is empty. ``` -------------------------------- ### Using firstWhere with BuiltList Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/firstWhere.html Demonstrates finding elements based on a condition and handling cases where no element matches using orElse. ```dart final numbers = [1, 2, 3, 5, 6, 7]; var result = numbers.firstWhere((element) => element < 5); // 1 result = numbers.firstWhere((element) => element > 5); // 6 result = numbers.firstWhere((element) => element > 10, orElse: () => -1); // -1 ``` -------------------------------- ### int get length Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/length.html Returns the number of keys currently present in the BuiltListMultimap. ```APIDOC ## int get length ### Description Returns the number of keys in the BuiltListMultimap. This property behaves as defined in ListMultimap.length. ### Signature `int get length` ### Returns - **int**: The count of keys in the map. ``` -------------------------------- ### void forEach(void Function(K, V) f) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/forEach.html Iterates through each key and its associated values in the multimap, applying the function f to every key-value pair. ```APIDOC ## void forEach(void Function(K, V) f) ### Description Iterates over all key-value pairs in the BuiltListMultimap. For each key, the provided function is called once for every value associated with that key. ### Parameters - **f** (void Function(K, V)) - Required - A function that takes a key of type K and a value of type V as arguments. ``` -------------------------------- ### Implementation of every Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/every.html The internal implementation of the every method for BuiltSet. ```dart @override bool every(bool Function(E) test) => _set.every(test); ``` -------------------------------- ### Implementation of removeRange Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/removeRange.html This method removes elements from the index start (inclusive) to end (exclusive). ```dart void removeRange(int start, int end) { _safeList.removeRange(start, end); } ``` -------------------------------- ### Conceptual reduce implementation Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/reduce.html This snippet illustrates the internal logic of how the reduce method processes elements. ```dart E value = iterable.first; iterable.skip(1).forEach((element) { value = combine(value, element); }); return value; ``` -------------------------------- ### E get last Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/last.html Returns the last element of the BuiltSet. Throws a StateError if the set is empty. ```APIDOC ## E get last ### Description Returns the last element of the BuiltSet. If the set is empty, this property throws a StateError. ### Signature `E get last` ### Behavior - Iterates through the elements to return the last one seen. - Throws `StateError` if the collection is empty. ``` -------------------------------- ### withDefaultBase() Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/withDefaultBase.html Resets the internal set factory to null and re-initializes the set using the default Set implementation, preserving existing elements. ```APIDOC ## void withDefaultBase() ### Description Resets the `base` collection to the default value, which instantiates a standard `Set`. This method clears any custom set factory configuration and migrates existing elements into the default set implementation. ### Signature `void withDefaultBase()` ``` -------------------------------- ### Iterable get reversed Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/reversed.html Returns an Iterable that iterates over the elements of this list in reverse order. ```APIDOC ## Iterable get reversed ### Description Returns an iterable that provides the elements of the BuiltList in reverse order. This behaves identically to the standard List.reversed property. ### Signature `Iterable get reversed` ``` -------------------------------- ### E get last Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/last.html Returns the last element of the BuiltList. Throws a StateError if the list is empty. ```APIDOC ## E get last ### Description Returns the last element of the BuiltList. If the list is empty, this property throws a StateError. ### Signature `E get last` ### Behavior - Returns the last element in the collection. - Throws `StateError` if the collection is empty. ``` -------------------------------- ### void take(int n) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/take.html Updates the builder in place by keeping only the first n elements of the list. ```APIDOC ## void take(int n) ### Description Updates the builder in place by taking the first n elements from the current list. This method behaves similarly to Iterable.take but modifies the internal state of the builder. ### Parameters - **n** (int) - Required - The number of elements to keep from the beginning of the list. ``` -------------------------------- ### Equivalent implementation logic Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/expand.html Shows the underlying logic of the expand method using a generator function. ```dart Iterable expand(Iterable toElements(E e)) sync* { for (var value in this) { yield* toElements(value); } } ``` -------------------------------- ### void forEachKey(void Function(K, Iterable) f) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/forEachKey.html Iterates through each key in the map and executes the provided function f, passing the key and its corresponding Iterable of values. ```APIDOC ## void forEachKey(void Function(K, Iterable) f) ### Description Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. ### Parameters - **f** (void Function(K, Iterable)) - Required - The function to apply to each key and its associated values. ``` -------------------------------- ### Iterable get values Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSetMultimap/values.html Retrieves all values from the BuiltSetMultimap as an Iterable. This implementation ensures the returned instance is stable. ```APIDOC ## Iterable get values ### Description Returns an iterable containing all values stored in the BuiltSetMultimap. The result is stable and returns the same instance on subsequent calls. ### Signature `Iterable get values` ``` -------------------------------- ### Iterating over BuiltList elements Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/forEach.html Demonstrates using the forEach method to print each element of a list. ```dart final numbers = [1, 2, 6, 7]; numbers.forEach(print); // 1 // 2 // 6 // 7 ``` -------------------------------- ### Implementation of toBuiltList Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListIterableExtension/toBuiltList.html The implementation creates a new BuiltList from the current iterable. ```dart BuiltList toBuiltList() => BuiltList.of(this); ``` -------------------------------- ### Iterable get keys Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/keys.html Returns an Iterable of the keys in the multimap. The result is stable and returns the same instance on subsequent calls. ```APIDOC ## Iterable get keys ### Description Returns an `Iterable` containing all the keys in the `BuiltListMultimap`. This implementation ensures that the returned instance is stable, meaning it returns the same object reference on subsequent calls. ### Signature `Iterable get keys` ### Returns - **Iterable** - An iterable collection of the keys present in the multimap. ``` -------------------------------- ### void addAll(Map other) Source: https://pub.dev/documentation/built_collection/latest/built_collection/MapBuilder/addAll.html Adds all entries from the specified map to this builder. This method validates the keys and values against existing constraints before updating the underlying map. ```APIDOC ## void addAll(Map other) ### Description Adds all key-value pairs from the provided `other` map into the `MapBuilder`. This operation performs internal validation on the keys and values of the input map before merging them into the builder's internal storage. ### Parameters - **other** (Map) - Required - The map containing the key-value pairs to be added. ``` -------------------------------- ### bool get isEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/isEmpty.html Returns true if the collection has no elements, false otherwise. This is computed by checking if the iterator has no next element. ```APIDOC ## bool get isEmpty ### Description Returns true if the collection has no elements. This property may be computed by checking if `iterator.moveNext()` returns `false`. ### Returns - **bool** - True if the collection is empty, false otherwise. ### Example ```dart final emptyList = []; print(emptyList.isEmpty); // true ``` ``` -------------------------------- ### String join([String separator = '']) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/join.html Converts each element of the BuiltList to a String and concatenates them, separated by the provided separator string. ```APIDOC ## join(String separator) ### Description Converts each element to a String and concatenates the strings, with the `separator` string interleaved between the elements. ### Parameters - **separator** (String) - Optional - The string to interleave between elements. Defaults to an empty string. ### Returns - **String** - The concatenated string representation of the list elements. ### Example ```dart final planetsByMass = {0.06: 'Mercury', 0.81: 'Venus', 0.11: 'Mars'}; final joinedNames = planetsByMass.values.join('-'); // Mercury-Venus-Mars ``` ``` -------------------------------- ### bool any(bool Function(E) test) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/any.html Checks every element in the BuiltSet in iteration order and returns true if any element satisfies the test function, otherwise returns false. ```APIDOC ## bool any(bool Function(E) test) ### Description Checks whether any element of this iterable satisfies `test`. Returns `true` if any element makes `test` return `true`, otherwise returns `false`. Returns `false` if the iterable is empty. ### Parameters - **test** (bool Function(E)) - Required - A function that takes an element of type E and returns a boolean. ### Returns - **bool** - True if at least one element satisfies the test, false otherwise. ### Example ```dart final numbers = [1, 2, 3, 5, 6, 7]; var result = numbers.any((element) => element >= 5); // true result = numbers.any((element) => element >= 10); // false ``` ``` -------------------------------- ### bool get isNotEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/isNotEmpty.html Returns true if the set has at least one element, false otherwise. This property behaves identically to Set.isNotEmpty. ```APIDOC ## bool get isNotEmpty ### Description Returns true if the set contains at least one element. This property is a direct proxy to the underlying Set.isNotEmpty implementation. ### Return Value - **bool** - True if the set is not empty, false if the set is empty. ``` -------------------------------- ### E get single Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/single.html Checks that this iterable has only one element, and returns that element. Throws a StateError if the set is empty or has more than one element. ```APIDOC ## E get single ### Description Checks that this iterable has only one element, and returns that element. This operation will not iterate past the second element. ### Throws - **StateError** - Thrown if the set is empty or has more than one element. ``` -------------------------------- ### List toList({bool growable = true}) Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/toList.html Creates a List containing the elements of this Iterable. The elements are in iteration order. The list is fixed-length if growable is false. ```APIDOC ## List toList({bool growable = true}) ### Description Creates a List containing the elements of this Iterable. The elements are in iteration order. The list is fixed-length if `growable` is false. ### Parameters - **growable** (bool) - Optional - Defaults to true. If false, the returned list is fixed-length. ### Example ```dart final planets = {1: 'Mercury', 2: 'Venus', 3: 'Mars'}; final keysList = planets.keys.toList(growable: false); // [1, 2, 3] final valuesList = planets.values.toList(growable: false); // [Mercury, Venus, Mars] ``` ``` -------------------------------- ### BuiltListMultimap.build Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/BuiltListMultimap.build.html Creates a ListMultimapBuilder, applies the provided update function to it, and builds the resulting BuiltListMultimap. ```APIDOC ## BuiltListMultimap.build ### Description Creates a ListMultimapBuilder, applies updates to it, and builds a new BuiltListMultimap instance. ### Signature BuiltListMultimap.build(Function(ListMultimapBuilder) updates) ### Parameters - **updates** (Function(ListMultimapBuilder)) - Required - A function that receives a ListMultimapBuilder to configure the collection before it is built. ``` -------------------------------- ### Iterable get values Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMap/values.html Returns an Iterable of the values in the map. The result is cached to ensure that the same instance is returned on every access. ```APIDOC ## Iterable get values ### Description Returns an `Iterable` containing all values present in the `BuiltMap`. Unlike standard `Map.values`, this implementation is stable and returns the same instance for every call. ### Signature `Iterable get values` ### Returns - **Iterable** - An iterable collection of the map's values. ``` -------------------------------- ### Iterable get values Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/values.html Retrieves all values in the multimap as an Iterable. The result is stable and returns the same instance upon subsequent calls. ```APIDOC ## Iterable get values ### Description Returns an `Iterable` containing all values stored in the `BuiltListMultimap`. This property is stable, meaning it returns the same instance on every access. ### Signature `Iterable get values` ### Returns - **Iterable** - An iterable collection of all values in the multimap. ``` -------------------------------- ### withBase(SetFactory base) Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/withBase.html Configures the SetBuilder to use the provided factory function to instantiate the underlying set collection. The factory must return a new, empty, and mutable set, and the resulting set must support standard set operations like difference, intersection, and union. ```APIDOC ## void withBase(_SetFactory base) ### Description Sets the factory function used to create the underlying collection for all sets generated by this builder. The provided factory must return a new, empty, and mutable set instance. ### Parameters - **base** (_SetFactory) - Required - A factory function that returns a new instance of a set. The returned set must be empty, mutable, and support set operations (difference, intersection, union) that return sets of the same type. ### Usage Example ```dart // Iterates over elements in ascending order. new SetBuilder()..withBase(() => new SplayTreeSet()); // Uses custom equality. new SetBuilder()..withBase(() => new LinkedHashSet( equals: (int a, int b) => a % 255 == b % 255, hashCode: (int n) => (n % 255).hashCode)); ``` ``` -------------------------------- ### BuiltListMultimap constructor Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/BuiltListMultimap.html Instantiates a new BuiltListMultimap with elements from a provided Map, ListMultimap, or another BuiltListMultimap. ```APIDOC ## BuiltListMultimap constructor ### Description Creates a new instance of BuiltListMultimap. It accepts an optional multimap argument which can be a Map, ListMultimap, or an existing BuiltListMultimap. ### Signature BuiltListMultimap([dynamic multimap = const {}]) ### Parameters - **multimap** (dynamic) - Optional - The source collection to initialize the BuiltListMultimap with. Defaults to an empty map. ``` -------------------------------- ### void setAll(int index, Iterable iterable) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/setAll.html Replaces elements in the list starting at the specified index with elements from the provided iterable. ```APIDOC ## setAll(int index, Iterable iterable) ### Description Overwrites elements in the list starting at the given `index` with the elements provided by the `iterable`. This method behaves similarly to the standard List.setAll method. ### Parameters - **index** (int) - The starting position in the list to begin replacing elements. - **iterable** (Iterable) - The collection of elements to insert into the list. ### Returns - **void** - This method does not return a value. ``` -------------------------------- ### Iterator get iterator Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/iterator.html Returns a new Iterator that allows iterating the elements of the BuiltSet. Each call to this property generates a fresh iterator instance. ```APIDOC ## Iterator get iterator ### Description Returns a new `Iterator` that allows iterating the elements of this `Iterable`. Each time `iterator` is read, it returns a new iterator, which can be used to iterate through all the elements again. ### Signature `Iterator get iterator` ### Details - **Returns**: `Iterator` - A new iterator instance for the collection. - **Behavior**: Iterators of the same iterable can be stepped through independently. Modifying the underlying collection after creating the iterator may cause an error when calling `Iterator.moveNext`. ``` -------------------------------- ### void update(Function(SetBuilder) updates) Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetBuilder/update.html Applies a provided function to the current SetBuilder instance. ```APIDOC ## void update(Function(SetBuilder) updates) ### Description Applies a function to the current SetBuilder instance to perform updates. ### Signature `void update(Function(SetBuilder) updates)` ### Parameters - **updates** (Function(SetBuilder)) - Required - A function that receives the current SetBuilder instance and performs modifications on it. ``` -------------------------------- ### set first Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/first.html Sets the first element of the list. ```APIDOC ## set first(E value) ### Description Updates the first element of the list to the provided value, equivalent to List.first = value. This operation includes internal validation checks. ### Signature `set first(E value)` ``` -------------------------------- ### Iterable get keys Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMap/keys.html Returns an Iterable of the keys in the map. Unlike standard Map.keys, this implementation is stable and returns the same instance on subsequent calls. ```APIDOC ## Iterable get keys ### Description Returns an iterable of the keys contained in the BuiltMap. This property provides a stable result, meaning it returns the same instance every time it is accessed. ### Signature `Iterable get keys` ### Returns - **Iterable** - An iterable collection of the map's keys. ``` -------------------------------- ### BuiltSetMultimap constructor Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSetMultimap/BuiltSetMultimap.html Instantiates a new BuiltSetMultimap with elements from a provided Map, SetMultimap, or existing BuiltSetMultimap. ```APIDOC ## BuiltSetMultimap constructor ### Description Creates a new instance of BuiltSetMultimap. It accepts an optional multimap argument which can be a Map, SetMultimap, or another BuiltSetMultimap to initialize the collection. ### Signature BuiltSetMultimap([dynamic multimap = const {}]) ### Parameters - **multimap** (dynamic) - Optional - The source collection used to populate the BuiltSetMultimap. Defaults to an empty map. ``` -------------------------------- ### bool get isNotEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMap/isNotEmpty.html Returns true if there is at least one entry in the map, false otherwise. This property behaves identically to the standard Map.isNotEmpty property. ```APIDOC ## bool get isNotEmpty ### Description Returns true if the map is not empty. This is a getter that checks if the underlying map contains any elements. ### Return Value - **bool** - Returns true if the map contains at least one key-value pair, otherwise false. ``` -------------------------------- ### Iterator get iterator Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/iterator.html Returns a new Iterator that allows iterating over the elements of the BuiltList. Each call to this property generates a fresh iterator instance. ```APIDOC ## Iterator get iterator ### Description Returns a new `Iterator` that allows iterating the elements of this `Iterable`. Each time `iterator` is read, it returns a new iterator, which can be used to iterate through all the elements again. ### Signature `Iterator get iterator` ### Behavior - Returns a new iterator instance. - Iterators can be stepped through independently. - Modifying the underlying collection may cause errors during subsequent `moveNext()` calls. ``` -------------------------------- ### BuiltListMultimap Constructors Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap-class.html Methods to instantiate a new BuiltListMultimap or build one from a builder function. ```APIDOC ## BuiltListMultimap([dynamic multimap]) Instantiates a new BuiltListMultimap with elements from a Map, ListMultimap, or another BuiltListMultimap. ## BuiltListMultimap.build(dynamic updates(ListMultimapBuilder)) Creates a ListMultimapBuilder, applies the provided update function, and returns a new BuiltListMultimap. ``` -------------------------------- ### bool get isNotEmpty Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltList/isNotEmpty.html Returns true if the collection has at least one element, otherwise false. This property is computed by checking if the iterator has a next element. ```APIDOC ## bool get isNotEmpty ### Description Returns true if the collection has at least one element. This is equivalent to checking if `iterator.moveNext()` returns `true`. ### Usage ```dart final numbers = BuiltList([1, 2, 3]); if (numbers.isNotEmpty) { print('Collection is not empty'); } ``` ### Returns - **bool** - True if the collection contains elements, false otherwise. ``` -------------------------------- ### SetMultimapBuilder constructor Source: https://pub.dev/documentation/built_collection/latest/built_collection/SetMultimapBuilder/SetMultimapBuilder.html Instantiates a new SetMultimapBuilder with optional initial elements. ```APIDOC ## SetMultimapBuilder constructor ### Description Creates a new instance of SetMultimapBuilder. The builder can be initialized with elements from a Map, SetMultimap, or BuiltSetMultimap. ### Signature SetMultimapBuilder([dynamic multimap = const {}]) ### Parameters - **multimap** (dynamic) - Optional - The initial elements to populate the builder with. Defaults to an empty map. ``` -------------------------------- ### void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) Source: https://pub.dev/documentation/built_collection/latest/built_collection/ListBuilder/setRange.html Overwrites a range of elements in the list with elements from the provided iterable. ```APIDOC ## setRange ### Description Overwrites the elements in the range [start, end) with the elements of iterable starting at position skipCount. ### Signature `void setRange(int start, int end, Iterable iterable, [int skipCount = 0])` ### Parameters - **start** (int) - The starting index of the range to overwrite (inclusive). - **end** (int) - The ending index of the range to overwrite (exclusive). - **iterable** (Iterable) - The source of the elements to copy into the list. - **skipCount** (int) - The number of elements to skip in the iterable before copying. Defaults to 0. ``` -------------------------------- ### BuiltMap build() Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltMapExtension/build.html Converts the current collection to a BuiltMap. ```APIDOC ## BuiltMap build() ### Description Converts the current collection to a BuiltMap. ### Signature `BuiltMap build()` ### Returns - **BuiltMap** - A new BuiltMap instance containing the elements of the current collection. ``` -------------------------------- ### int get hashCode Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltSet/hashCode.html Returns a deep hash code for the BuiltSet. Two BuiltSet instances are considered equal if they contain equal elements in any order, and this property ensures they share the same hash code. ```APIDOC ## int get hashCode ### Description Returns a deep hash code for the BuiltSet. A `BuiltSet` is only equal to another `BuiltSet` with equal elements in any order, and this property guarantees that such sets have the same hash code. ### Return Value - **int** - The calculated hash code for the set. ``` -------------------------------- ### BuiltListMultimap Methods Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap-class.html Core methods for interacting with the BuiltListMultimap, including conversion and iteration. ```APIDOC ## asMap() Returns the multimap as an immutable Map>. ## rebuild(dynamic updates(ListMultimapBuilder)) Converts the current instance to a ListMultimapBuilder, applies updates, and returns a new BuiltListMultimap. ## toBuilder() Converts the current instance to a ListMultimapBuilder for modification. ## toMap() Converts the multimap to a Map>. ``` -------------------------------- ### int get hashCode Source: https://pub.dev/documentation/built_collection/latest/built_collection/BuiltListMultimap/hashCode.html Returns a deep hash code for the BuiltListMultimap. Two BuiltListMultimap instances are considered equal if they contain the same key-value pairs, regardless of order, and this property guarantees they will have the same hash code. ```APIDOC ## int get hashCode ### Description Returns a deep hash code for the BuiltListMultimap. This property is overridden to ensure that equality between two BuiltListMultimap instances (based on key-value pairs) results in identical hash codes. ### Signature `int get hashCode` ### Returns - **int**: The computed hash code for the collection. ```