Jeet Bhalujeetbhalu.hashnode.dev·10 minutes agoDart Iterable removeAt().removeAt() This method is a remove data from index using a data to index . void main() { var iterable = [1, 2, 3, 4, 5].where((element) => element.isEven); var list = iterable.toList(); list.removeAt(1); print(list); } [2] Exited.DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·35 minutes agoDart Iterable removeLast().removeLast() Removes and returns the last element of the queue. The queue must not be empty when this method is called. extension IterableExtensions<E> on Iterable<E> { E? removeLast() { if (isEmpty) return null; var list = toList(); ...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·an hour agoDart Iterable singlewhere().singlewhere() void main() { List<int> numList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; int result = numList.singleWhere((element) => element > 2 && element < 4); print(result); } output 3 Exited.DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·an hour agoDart Iterable Shuffle().Shuffle() A shuffle is a randomly set in program in list shuffling and modify list . Example void main() { var nums = [1, 2, 3, 4, 5, 6, 6]; print('nums : $nums'); nums.shuffle(); print(nums); } Output nums : [1, 2, 3, 4, 5, 6, 6] [1, 6, 2...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·2 hours agoDart Iterale Sort().Sort() A sort() method is used to sort the elements of an iterable in ascending order. Example void main() { var numbers = [1, 2, 3, 4, 1, 4, 2, 5, 6, 1, 3, 5, 3]; numbers.sort(); print(numbers); } Output [1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5,...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·2 hours agoDart Iterable Take() & TakeWhile().Take() This method returns an Iterable containing the first count elements from the original Iterable. TakeWhile() This method returns an Iterable containing the initial elements of the original Iterable as long as the specified condition (test) i...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·2 hours agoDart Iterable Skip() & SkipWhile()Skip() This method skips the first elements from the iterable and returns a new iterable that starts after those elements. SkipWhile() This method skips elements while a condition is true, and once the condition becomes false for an element, it st...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·2 hours agoDart Iterable Contains().Contains() Whether the collection contains an element equal to element. This operation will check each element in order for being equal to element, unless it has a more efficient way to find an element equal to element. Stops iterating on the first...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·3 hours agoDart Iterable subList().subList() A sublist method is used to return a new list containing a portion of an existing list. The portion of the list is defined by two arguments: the starting index and the ending index. List<T> sublist<T>(List<T> list, int start, [int? end]) ...DiscussDart
Jeet Bhalujeetbhalu.hashnode.dev·3 hours agoDart Iterable Where()Where() A Where() method is an extension provided by the Iterable class. The where() method takes a callback function as an argument. void main() { Iterable<int> number = [1, 2, 3, 4]; Iterable even = number.where((number) => number.isEven);...DiscussDart