toPointer function
dynamic
toPointer(
- dynamic data
Implementation
toPointer(data) {
if (data is Float32List ||
data.runtimeType.toString() == "List<double>" ||
data.runtimeType.toString() == "List<num>" ||
data.runtimeType.toString() == "_GrowableList<double>") {
final Pointer<Float> ptr = calloc<Float>(data.length);
ptr.asTypedList(data.length).setAll(0, List<double>.from(data));
return ptr;
} else if (data is Uint8List) {
final Pointer<Uint8> ptr = calloc<Uint8>(data.length);
ptr.asTypedList(data.length).setAll(0, data);
return ptr;
} else if (data is List<int>) {
final Pointer<Uint32> ptr = calloc<Uint32>(data.length);
ptr.asTypedList(data.length).setAll(0, data.map((e) => e));
return ptr;
} else {
throw (" flutter_gl OpenGLContextES.dart toPointer ${data.runtimeType} TODO ");
}
}