isSqliteDynamicLibraryLoadFailure function
Whether error is dart:ffi's native-assets failure to LOAD the bundled
libsqlite3 dynamic library (gh-1574) rather than a database-level
error. An AOT binary built with dart build cli resolves its bundled
libraries at <exe_dir>/../lib/<name>; when the library is missing the
first sqlite3_* symbol call throws an ArgumentError carrying the
resolver's message ("Couldn't resolve native function … Failed to load
dynamic library …").
Implementation
bool isSqliteDynamicLibraryLoadFailure(Object error) {
if (error is! ArgumentError) return false;
final message = '${error.message}';
return message.contains('Failed to load dynamic library') ||
message.contains("Couldn't resolve native function");
}