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
// TODO runtimeType on web release mode will not same as debug
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
}