I am trying to use the rust implementation of web audio api and call it from a flutter app. When I try to create an AudioContext in rust and call it from flutter, I have a panic error :
E/flutter (20079): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(PANIC_ERROR, android context was not initialized, null)
Here is my rust function (cropped the end, throw the error at the AudioContext Creation) :
pub fn play_sine_wave(){
let context = AudioContext::default();
And here is how I call it from flutter :
final dylib = loadDylib('librust.so');
final api = RustImpl(dylib);
void playButtonClicked() async {
await api.playSineWave();
}
I follow the flutter rust bridge tutorial and can call a basic increment rust function to increment an int in rust and get it back in flutter. Is there is something that I am missing ?