list_extension

Custom methods and propeties for List added via Dart extension.

Install

Added in project's pubspec:


dependencies:
  list_extension: any

...

Usage

indices: Return a list with all indices.

final list = ['hello', 'test'];

for(var index in list.indices){
  print("Index: $index | Value: ${list[index]}");
}

copy: Create a new instance of list with the same items.

final list = ['hello', 'test'];
final copy = list.copy();

print(list.hashCode == copy.hashCode); // false

lastIndex: The number of last index in this list.

final list = ['hello', 'test'];

print(list.lastIndex); // 1

Libraries

list_extension
Custom method and propeties for list added with Dart extension