Dart API Referencedart:htmlTextTrackCueList

TextTrackCueList class

@DocsEditable
@DomName('TextTrackCueList')
class TextTrackCueList extends Interceptor with ListMixin<TextTrackCue>, ImmutableListMixin<TextTrackCue> implements List<TextTrackCue>, JavaScriptIndexingBehavior native "TextTrackCueList" {

 @DomName('TextTrackCueList.length')
 @DocsEditable
 int get length => JS("int", "#.length", this);

 TextTrackCue operator[](int index) {
   if (JS("bool", "# >>> 0 !== # || # >= #", index,
       index, index, length))
     throw new RangeError.range(index, 0, length);
   return JS("TextTrackCue", "#[#]", this, index);
 }
 void operator[]=(int index, TextTrackCue value) {
   throw new UnsupportedError("Cannot assign element of immutable List.");
 }
 // -- start List<TextTrackCue> mixins.
 // TextTrackCue is the element type.


 void set length(int value) {
   throw new UnsupportedError("Cannot resize immutable List.");
 }

 TextTrackCue get first {
   if (this.length > 0) {
     return JS('TextTrackCue', '#[0]', this);
   }
   throw new StateError("No elements");
 }

 TextTrackCue get last {
   int len = this.length;
   if (len > 0) {
     return JS('TextTrackCue', '#[#]', this, len - 1);
   }
   throw new StateError("No elements");
 }

 TextTrackCue get single {
   int len = this.length;
   if (len == 1) {
     return JS('TextTrackCue', '#[0]', this);
   }
   if (len == 0) throw new StateError("No elements");
   throw new StateError("More than one element");
 }

 TextTrackCue elementAt(int index) => this[index];
 // -- end List<TextTrackCue> mixins.

 @DomName('TextTrackCueList.getCueById')
 @DocsEditable
 TextTrackCue getCueById(String id) native;

 @DomName('TextTrackCueList.item')
 @DocsEditable
 TextTrackCue item(int index) native;
}

Extends

Interceptor > Interceptor_ListMixin > Interceptor_ListMixin_ImmutableListMixin > TextTrackCueList

Implements

JavaScriptIndexingBehavior, List<TextTrackCue>

Properties

final TextTrackCue first #

Returns the first element.

If this is empty throws a StateError. Otherwise this method is equivalent to this.elementAt(0)

docs inherited from Iterable<E>
TextTrackCue get first {
 if (this.length > 0) {
   return JS('TextTrackCue', '#[0]', this);
 }
 throw new StateError("No elements");
}

final int hashCode #

inherited from Interceptor

Get a hash code for this object.

All objects have hash codes. Hash codes are guaranteed to be the same for objects that are equal when compared using the equality operator ==. Other than that there are no guarantees about the hash codes. They will not be consistent between runs and there are no distribution guarantees.

If a subclass overrides hashCode it should override the equality operator as well to maintain consistency.

docs inherited from Object
int get hashCode => Primitives.objectHashCode(this);

final bool isEmpty #

inherited from Interceptor_ListMixin

Returns true if there is no element in this collection.

docs inherited from Iterable<E>
bool get isEmpty => length == 0;

final Iterator<E> iterator #

Returns an Iterator that iterates over this Iterable object.

docs inherited from Iterable<E>
Iterator<E> get iterator {
 // Note: NodeLists are not fixed size. And most probably length shouldn't
 // be cached in both iterator _and_ forEach method. For now caching it
 // for consistency.
 return new FixedSizeListIterator<E>(this);
}

final TextTrackCue last #

Returns the last element.

If this is empty throws a StateError.

docs inherited from Iterable<E>
TextTrackCue get last {
 int len = this.length;
 if (len > 0) {
   return JS('TextTrackCue', '#[#]', this, len - 1);
 }
 throw new StateError("No elements");
}

int get length #

Returns the number of elements in the list.

The valid indices for a list are 0 through length - 1.

docs inherited from List<TextTrackCue>
@DomName('TextTrackCueList.length')
@DocsEditable
int get length => JS("int", "#.length", this);

void set length(int value) #

Changes the length of the list. If newLength is greater than the current length, entries are initialized to null. Throws an UnsupportedError if the list is not extendable.

docs inherited from List<TextTrackCue>
void set length(int value) {
 throw new UnsupportedError("Cannot resize immutable List.");
}

final Iterable<E> reversed #

inherited from Interceptor_ListMixin

Returns an Iterable of the elements of this List in reverse order.

docs inherited from List<E>
Iterable<E> get reversed => new ReversedListIterable(this);

final Type runtimeType #

inherited from Interceptor

A representation of the runtime type of the object.

docs inherited from Object
Type get runtimeType => getRuntimeType(this);

final TextTrackCue single #

Returns the single element in this.

If this is empty or has more than one element throws a StateError.

docs inherited from Iterable<E>
TextTrackCue get single {
 int len = this.length;
 if (len == 1) {
   return JS('TextTrackCue', '#[0]', this);
 }
 if (len == 0) throw new StateError("No elements");
 throw new StateError("More than one element");
}

Operators

TextTrackCue operator [](int index) #

Returns the element at the given index in the list or throws an RangeError if index is out of bounds.

docs inherited from List<TextTrackCue>
TextTrackCue operator[](int index) {
 if (JS("bool", "# >>> 0 !== # || # >= #", index,
     index, index, length))
   throw new RangeError.range(index, 0, length);
 return JS("TextTrackCue", "#[#]", this, index);
}

void operator []=(int index, TextTrackCue value) #

Sets the entry at the given index in the list to value. Throws an RangeError if index is out of bounds.

docs inherited from List<TextTrackCue>
void operator[]=(int index, TextTrackCue value) {
 throw new UnsupportedError("Cannot assign element of immutable List.");
}

bool operator ==(other) #

inherited from Interceptor

The equality operator.

The default behavior for all Objects is to return true if and only if this and other are the same object.

If a subclass overrides the equality operator it should override the hashCode method as well to maintain consistency.

docs inherited from Object
bool operator ==(other) => identical(this, other);

Methods

void add(E value) #

Adds value at the end of the list, extending the length by one. Throws an UnsupportedError if the list is not extendable.

docs inherited from List<E>
void add(E value) {
 throw new UnsupportedError("Cannot add to immutable List.");
}

void addAll(Iterable<E> iterable) #

Appends all elements of the iterable to the end of this list. Extends the length of the list by the number of elements in iterable. Throws an UnsupportedError if this list is not extensible.

docs inherited from List<E>
void addAll(Iterable<E> iterable) {
 throw new UnsupportedError("Cannot add to immutable List.");
}

bool any(bool test(E element)) #

inherited from Interceptor_ListMixin

Returns true if one element of this collection satisfies the predicate f. Returns false otherwise.

docs inherited from Iterable<E>
bool any(bool test(E element)) {
 int length = this.length;
 for (int i = 0; i < length; i++) {
   if (test(this[i])) return true;
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 return false;
}

Map<int, E> asMap() #

inherited from Interceptor_ListMixin

Returns an unmodifiable Map view of this.

It has the indices of this list as keys, and the corresponding elements as values.

docs inherited from List<E>
Map<int, E> asMap() {
 return new ListMapView(this);
}

void clear() #

inherited from Interceptor_ListMixin

Removes all elements in the list.

The length of the list becomes zero. Throws an UnsupportedError, and retains all elements, if the length of the list cannot be changed.

docs inherited from List<E>
void clear() { this.length = 0; }

bool contains(E element) #

inherited from Interceptor_ListMixin

Check whether the collection contains an element equal to element.

docs inherited from Iterable<E>
bool contains(E element) {
 int length = this.length;
 for (int i = 0; i < length; i++) {
   if (this[i] == element) return true;
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 return false;
}

TextTrackCue elementAt(int index) #

Returns the indexth element.

If [this] [Iterable] has fewer than index elements throws a RangeError.

Note: if this does not have a deterministic iteration order then the function may simply return any element without any iteration if there are at least index elements in this.

docs inherited from Iterable<E>
TextTrackCue elementAt(int index) => this[index];

bool every(bool test(E element)) #

inherited from Interceptor_ListMixin

Returns true if every elements of this collection satisify the predicate f. Returns false otherwise.

docs inherited from Iterable<E>
bool every(bool test(E element)) {
 int length = this.length;
 for (int i = 0; i < length; i++) {
   if (!test(this[i])) return false;
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 return true;
}

Iterable expand(Iterable f(E element)) #

inherited from Interceptor_ListMixin

Expand each element of this Iterable into zero or more elements.

The resulting Iterable will run through the elements returned by f for each element of this, in order.

The returned Iterable is lazy, and will call f for each element of this every time it's iterated.

docs inherited from Iterable<E>
Iterable expand(Iterable f(E element)) =>
   new ExpandIterable<E, dynamic>(this, f);

void fillRange(int start, int end, [E fillValue]) #

Sets the elements in the range start to end exclusive to the given fillValue.

It is an error if start.. end is not a valid range pointing into the this.

docs inherited from List<E>
void fillRange(int start, int end, [E fillValue]) {
 throw new UnsupportedError("Cannot modify an immutable List.");
}

E firstWhere(bool test(E element), {E orElse()}) #

inherited from Interceptor_ListMixin

Returns the first element that satisfies the given predicate f.

If none matches, the result of invoking the orElse function is returned. By default, when orElse is null, a StateError is thrown.

docs inherited from Iterable<E>
E firstWhere(bool test(E element), { E orElse() }) {
 int length = this.length;
 for (int i = 0; i < length; i++) {
   E element = this[i];
   if (test(element)) return element;
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 if (orElse != null) return orElse();
 throw new StateError("No matching element");
}

dynamic fold(initialValue, combine(previousValue, E element)) #

inherited from Interceptor_ListMixin

Reduces a collection to a single value by iteratively combining each element of the collection with an existing value using the provided function.

Use initialValue as the initial value, and the function combine to create a new value from the previous one and an element.

Example of calculating the sum of an iterable:

iterable.fold(0, (prev, element) => prev + element);
docs inherited from Iterable<E>
fold(var initialValue, combine(var previousValue, E element)) {
 var value = initialValue;
 int length = this.length;
 for (int i = 0; i < length; i++) {
   value = combine(value, this[i]);
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 return value;
}

void forEach(void action(E element)) #

inherited from Interceptor_ListMixin

Applies the function f to each element of this collection.

docs inherited from Iterable<E>
void forEach(void action(E element)) {
 int length = this.length;
 for (int i = 0; i < length; i++) {
   action(this[i]);
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
}

TextTrackCue getCueById(String id) #

@DomName('TextTrackCueList.getCueById')
@DocsEditable
TextTrackCue getCueById(String id) native;

Iterable<E> getRange(int start, int end) #

inherited from Interceptor_ListMixin

Returns an Iterable that iterators over the elements in the range start to end exclusive. The result of this function is backed by this.

It is an error if end is before start.

It is an error if the start and end are not valid ranges at the time of the call to this method. The returned Iterable behaves similar to skip(start).take(end - start). That is, it will not throw exceptions if this changes size.

Example:

var list = [1, 2, 3, 4, 5];
var range = list.getRange(1, 4);
print(range.join(', '));  // => 2, 3, 4
list.length = 3;
print(range.join(', '));  // => 2, 3
docs inherited from List<E>
Iterable<E> getRange(int start, int end) {
 _rangeCheck(start, end);
 return new SubListIterable(this, start, end);
}

int indexOf(E element, [int startIndex = 0]) #

inherited from Interceptor_ListMixin

Returns the first index of element in the list.

Searches the list from index start to the length of the list. The first time an element e is encountered so that e == element, the index of e is returned. Returns -1 if element is not found.

docs inherited from List<E>
int indexOf(E element, [int startIndex = 0]) {
 if (startIndex >= this.length) {
   return -1;
 }
 if (startIndex < 0) {
   startIndex = 0;
 }
 for (int i = startIndex; i < this.length; i++) {
   if (this[i] == element) {
     return i;
   }
 }
 return -1;
}

void insert(int index, E element) #

Inserts the element at position index in the list.

This increases the length of the list by one and shifts all elements at or after the index towards the end of the list.

It is an error if the index does not point inside the list or at the position after the last element.

docs inherited from List<E>
void insert(int index, E element) {
 throw new UnsupportedError("Cannot add to immutable List.");
}

void insertAll(int index, Iterable<E> iterable) #

Inserts all elements of iterable at position index in the list.

This increases the length of the list by the length of iterable and shifts all later elements towards the end of the list.

It is an error if the index does not point inside the list or at the position after the last element.

docs inherited from List<E>
void insertAll(int index, Iterable<E> iterable) {
 throw new UnsupportedError("Cannot add to immutable List.");
}

TextTrackCue item(int index) #

@DomName('TextTrackCueList.item')
@DocsEditable
TextTrackCue item(int index) native;

String join([String separator = ""]) #

inherited from Interceptor_ListMixin

Converts each element to a String and concatenates the strings.

Converts each element to a String by calling Object.toString on it. Then concatenates the strings, optionally separated by the separator string.

docs inherited from Iterable<E>
String join([String separator = ""]) {
 int length = this.length;
 if (!separator.isEmpty) {
   if (length == 0) return "";
   String first = "${this[0]}";
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
   StringBuffer buffer = new StringBuffer(first);
   for (int i = 1; i < length; i++) {
     buffer.write(separator);
     buffer.write(this[i]);
     if (length != this.length) {
       throw new ConcurrentModificationError(this);
     }
   }
   return buffer.toString();
 } else {
   StringBuffer buffer = new StringBuffer();
   for (int i = 0; i < length; i++) {
     buffer.write(this[i]);
     if (length != this.length) {
       throw new ConcurrentModificationError(this);
     }
   }
   return buffer.toString();
 }
}

int lastIndexOf(E element, [int startIndex]) #

inherited from Interceptor_ListMixin

Returns the last index in the list a of the given element, starting the search at index startIndex to 0. Returns -1 if element is not found.

int lastIndexOf(E element, [int startIndex]) {
 if (startIndex == null) {
   startIndex = this.length - 1;
 } else {
   if (startIndex < 0) {
     return -1;
   }
   if (startIndex >= this.length) {
     startIndex = this.length - 1;
   }
 }
 for (int i = startIndex; i >= 0; i--) {
   if (this[i] == element) {
     return i;
   }
 }
 return -1;
}

E lastWhere(bool test(E element), {E orElse()}) #

inherited from Interceptor_ListMixin

Returns the last element that satisfies the given predicate f.

If none matches, the result of invoking the orElse function is returned. By default, when orElse is null, a StateError is thrown.

docs inherited from Iterable<E>
E lastWhere(bool test(E element), { E orElse() }) {
 int length = this.length;
 for (int i = length - 1; i >= 0; i--) {
   E element = this[i];
   if (test(element)) return element;
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 if (orElse != null) return orElse();
 throw new StateError("No matching element");
}

Iterable map(f(E element)) #

inherited from Interceptor_ListMixin

Returns a lazy Iterable where each element e of this is replaced by the result of f(e).

This method returns a view of the mapped elements. As long as the returned Iterable is not iterated over, the supplied function f will not be invoked. The transformed elements will not be cached. Iterating multiple times over the the returned Iterable will invoke the supplied function f multiple times on the same element.

docs inherited from Iterable<E>
Iterable map(f(E element)) => new MappedListIterable(this, f);

dynamic noSuchMethod(Invocation invocation) #

inherited from Interceptor

noSuchMethod is invoked when users invoke a non-existant method on an object. The name of the method and the arguments of the invocation are passed to noSuchMethod in an Invocation. If noSuchMethod returns a value, that value becomes the result of the original invocation.

The default behavior of noSuchMethod is to throw a noSuchMethodError.

docs inherited from Object
dynamic noSuchMethod(Invocation invocation) {
 throw new NoSuchMethodError(
     this,
     _symbolToString(invocation.memberName),
     invocation.positionalArguments,
     _symbolMapToStringMap(invocation.namedArguments));
}

E reduce(E combine(E previousValue, E element)) #

inherited from Interceptor_ListMixin

Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.

Example of calculating the sum of an iterable:

iterable.reduce((value, element) => value + element);
docs inherited from Iterable<E>
E reduce(E combine(E previousValue, E element)) {
 if (length == 0) throw new StateError("No elements");
 E value = this[0];
 for (int i = 1; i < length; i++) {
   value = combine(value, this[i]);
 }
 return value;
}

void remove(Object object) #

Removes value from the list. Returns true if value was in the list. Returns false otherwise. The method has no effect if value value was not in the list.

docs inherited from List<E>
void remove(Object object) {
 throw new UnsupportedError("Cannot remove from immutable List.");
}

E removeAt(int pos) #

Removes the element at position index from the list.

This reduces the length of the list by one and moves all later elements down by one position. Returns the removed element. Throws an ArgumentError if index is not an int. Throws an RangeError if the index does not point inside the list. Throws an UnsupportedError, and doesn't remove the element, if the length of the list cannot be changed.

docs inherited from List<E>
E removeAt(int pos) {
 throw new UnsupportedError("Cannot remove from immutable List.");
}

E removeLast() #

Pops and returns the last element of the list. Throws a UnsupportedError if the length of the list cannot be changed.

docs inherited from List<E>
E removeLast() {
 throw new UnsupportedError("Cannot remove from immutable List.");
}

void removeRange(int start, int end) #

Removes the elements in the range start to end exclusive.

It is an error if start.. end is not a valid range pointing into the this.

docs inherited from List<E>
void removeRange(int start, int end) {
 throw new UnsupportedError("Cannot removeRange on immutable List.");
}

void removeWhere(bool test(E element)) #

Removes all elements of this list that satisfy test.

An elements e satisfies test if test(e) is true.

docs inherited from List<E>
void removeWhere(bool test(E element)) {
 throw new UnsupportedError("Cannot remove from immutable List.");
}

void replaceRange(int start, int end, Iterable<E> iterable) #

Removes the elements in the range start to end exclusive and replaces them with the contents of the iterable.

It is an error if start.. end is not a valid range pointing into the this.

Example:

var list = [1, 2, 3, 4, 5];
list.replaceRange(1, 3, [6, 7, 8, 9]);
print(list);  // [1, 6, 7, 8, 9, 4, 5]
docs inherited from List<E>
void replaceRange(int start, int end, Iterable<E> iterable) {
 throw new UnsupportedError("Cannot modify an immutable List.");
}

void retainWhere(bool test(E element)) #

Removes all elements of this list that fail to satisfy test.

An elements e satisfies test if test(e) is true.

docs inherited from List<E>
void retainWhere(bool test(E element)) {
 throw new UnsupportedError("Cannot remove from immutable List.");
}

void setAll(int index, Iterable<E> iterable) #

Overwrites elements of this with the elemenst of iterable starting at position index in the list.

This operation does not increase the length of the list.

It is an error if the index does not point inside the list or at the position after the last element.

It is an error if the iterable is longer than length - index.

docs inherited from List<E>
void setAll(int index, Iterable<E> iterable) {
 throw new UnsupportedError("Cannot modify an immutable List.");
}

void setRange(int start, int end, Iterable<E> iterable, [int skipCount]) #

Copies the elements of iterable, skipping the skipCount first elements into the range start to end exclusive of this.

If start equals end and represent a legal range, this method has no effect.

It is an error if start.. end is not a valid range pointing into the this.

It is an error if the iterable does not have enough elements after skipping skipCount elements.

docs inherited from List<E>
void setRange(int start, int end, Iterable<E> iterable, [int skipCount]) {
 throw new UnsupportedError("Cannot setRange on immutable List.");
}

E singleWhere(bool test(E element)) #

inherited from Interceptor_ListMixin

Returns the single element that satisfies f. If no or more than one element match then a StateError is thrown.

docs inherited from Iterable<E>
E singleWhere(bool test(E element)) {
 int length = this.length;
 E match = null;
 bool matchFound = false;
 for (int i = 0; i < length; i++) {
   E element = this[i];
   if (test(element)) {
     if (matchFound) {
       throw new StateError("More than one matching element");
     }
     matchFound = true;
     match = element;
   }
   if (length != this.length) {
     throw new ConcurrentModificationError(this);
   }
 }
 if (matchFound) return match;
 throw new StateError("No matching element");
}

Iterable<E> skip(int count) #

inherited from Interceptor_ListMixin

Returns an Iterable that skips the first n elements.

If this has fewer than n elements, then the resulting Iterable will be empty.

docs inherited from Iterable<E>
Iterable<E> skip(int count) => new SubListIterable(this, count, null);

Iterable<E> skipWhile(bool test(E element)) #

inherited from Interceptor_ListMixin

Returns an Iterable that skips elements while test is satisfied.

The filtering happens lazily. Every new Iterator of the returned Iterable will iterate over all elements of this. As long as the iterator's elements do not satisfy test they are discarded. Once an element satisfies the test the iterator stops testing and uses every element unconditionally.

docs inherited from Iterable<E>
Iterable<E> skipWhile(bool test(E element)) {
 return new SkipWhileIterable<E>(this, test);
}

void sort([int compare(E a, E b)]) #

Sorts the list according to the order specified by the compare function.

The compare function must act as a Comparator. The default List implementations use Comparable.compare if compare is omitted.

docs inherited from List<E>
void sort([int compare(E a, E b)]) {
 throw new UnsupportedError("Cannot sort immutable List.");
}

List<E> sublist(int start, [int end]) #

inherited from Interceptor_ListMixin

Returns a new list containing the elements from start to end.

If end is omitted, the length of the list is used.

It is an error if start or end are not list indices for this list, or if end is before start.

docs inherited from List<E>
List<E> sublist(int start, [int end]) {
 if (end == null) end = length;
 _rangeCheck(start, end);
 int length = end - start;
 List<E> result = new List<E>()..length = length;
 for (int i = 0; i < length; i++) {
   result[i] = this[start + i];
 }
 return result;
}

Iterable<E> take(int count) #

inherited from Interceptor_ListMixin

Returns an Iterable with at most n elements.

The returned Iterable may contain fewer than n elements, if this contains fewer than n elements.

docs inherited from Iterable<E>
Iterable<E> take(int count) => new SubListIterable(this, 0, count);

Iterable<E> takeWhile(bool test(E element)) #

inherited from Interceptor_ListMixin

Returns an Iterable that stops once test is not satisfied anymore.

The filtering happens lazily. Every new Iterator of the returned Iterable will start iterating over the elements of this. When the iterator encounters an element e that does not satisfy test, it discards e and moves into the finished state. That is, it will not ask or provide any more elements.

docs inherited from Iterable<E>
Iterable<E> takeWhile(bool test(E element)) {
 return new TakeWhileIterable<E>(this, test);
}

List<E> toList({bool growable: true}) #

inherited from Interceptor_ListMixin

Creates a List containing the elements of this Iterable.

The elements will be in iteration order. The list is fixed-length if growable is false.

docs inherited from Iterable<E>
List<E> toList({ bool growable: true }) {
 List<E> result;
 if (growable) {
   result = new List<E>()..length = length;
 } else {
   result = new List<E>(length);
 }
 for (int i = 0; i < length; i++) {
   result[i] = this[i];
 }
 return result;
}

Set<E> toSet() #

inherited from Interceptor_ListMixin

Creates a Set containing the elements of this Iterable.

docs inherited from Iterable<E>
Set<E> toSet() {
 Set<E> result = new Set<E>();
 for (int i = 0; i < length; i++) {
   result.add(this[i]);
 }
 return result;
}

String toString() #

inherited from Interceptor_ListMixin

Returns a string representation of this object.

docs inherited from Object
String toString() => ToString.iterableToString(this);

Iterable<E> where(bool test(E element)) #

inherited from Interceptor_ListMixin

Returns a lazy Iterable with all elements that satisfy the predicate f.

This method returns a view of the mapped elements. As long as the returned Iterable is not iterated over, the supplied function f will not be invoked. Iterating will not cache results, and thus iterating multiple times over the the returned Iterable will invoke the supplied function f multiple times on the same element.

docs inherited from Iterable<E>
Iterable<E> where(bool test(E element)) => new WhereIterable<E>(this, test);