In my Flutter app, there is a heavy task that forces me to use isolates in order to have a smooth UI, and that task includes reading some assets files using the rootBundle and searching through them for a certain text. Now since the main isolate that renders the UI doesn't share memory with the spawned isolate that will do the heavy task for me, whenever I try to use the rootBundle inside the method which the spawned isolate runs, I get this error:
ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
And of course using WidgetsFlutterBinding.ensureInitialized(); at the top of the method doesn't work. And I tried to send the rootBundle to the spawned Isolate and using it there but that didn't work.