copy method
Returns a copy of this List.
- It tries to preserve the type if it's an Uint8List, Uint16List, Uint32List or Uint64List.
Implementation
List<T> copy() {
if (this is Uint8List) {
return Uint8List.fromList(this as Uint8List) as List<T>;
} else if (this is Int8List) {
return Int8List.fromList(this as Int8List) as List<T>;
} else if (this is Uint16List) {
return Uint16List.fromList(this as Uint16List) as List<T>;
} else if (this is Int16List) {
return Int16List.fromList(this as Int16List) as List<T>;
} else if (this is Uint32List) {
return Uint32List.fromList(this as Uint32List) as List<T>;
} else if (this is Int32List) {
return Int32List.fromList(this as Int32List) as List<T>;
} else if (this is Uint64List) {
return Uint64List.fromList(this as Uint64List) as List<T>;
} else if (this is Int64List) {
return Int64List.fromList(this as Int64List) as List<T>;
} else {
return List<T>.from(this);
}
}