Implementation
Future<TemplateIndex> createIndex(List<Template> templates, int search_threads_count, int reserve_queries_count) async {
ReceivePort receivePort = ReceivePort();
List<int> pointers = [];
templates.forEach((template) => pointers.add(template._impl.address));
_sendPort.send({
"event": _RecognizerEvents.CREATE_INDEX,
"sendPort": receivePort.sendPort,
"pointers": pointers,
"search_threads_count": search_threads_count,
"reserve_queries_count": reserve_queries_count
});
int result = await receivePort.first;
return TemplateIndex(DynamicLibrary.open(_dllPath), Pointer<Void>.fromAddress(result));
}