cast<R> method
override
Returns a view of this list as a list of R
instances.
If this list contains only instances of R
, all read operations will work correctly. If any operation tries to access an element that is not an instance of R
, the access will throw instead.
Elements added to the list (e.g., by using add or addAll) must be instance of R
to be valid arguments to the adding function, and they must be instances of E
as well to be accepted by this list as well.
Typically implemented as List.castFrom<E, R>(this)
.
Implementation
List<R> cast<R>() => List.castFrom<E, R>(this);
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-collection/ListMixin/cast.html