After installing a flutter application, the base.apk and FFI .so files (example: libsodium.so) are located in a directory with a seemingly random name, which appears to be randomized upon each install. This directory may be referred to sometimes as nativeLibraryDir.

For example, it looks similar to:

/data/app/~~jsoifn2hofsdsohg2new==/com.example.flutter_app-Ajosdfomw_cbxomwowmeof==/lib/${arch}/libsodium.so /data/app/~~jsoifn2hofsdsohg2new==/com.example.flutter_app-Ajosdfomw_cbxomwowmeof==/base.apk

I need my application to be able to determine this location (and return it as a string), but I cannot find a mechanism to determine it. Flutter itself must have a mechanism, since DynamicLibrary.open("libsodium.so") is able to determine it for FFI purposes, but I cannot find a user-exposed method to determine it and return it as a string.

I tried getLibraryLocation from PathProvider, but apparently that is not what it is intended to return. https://github.com/flutter/flutter/issues/113054