convertArray static method
dynamic
convertArray(
- dynamic array,
- String type, [
- bool forceClone = false
])
Implementation
static convertArray(array, String type, [bool forceClone = false]) {
// var 'null' and 'null' pass
if (array == null || !forceClone && array.runtimeType.toString() == type) {
return array;
}
if (array is NativeArray && type == 'List<num>') {
return array.toDartList();
}
if (type == 'List<num>') {
// create typed array
return List<num>.from(array);
}
return slice(array, 0); // create Array
}