Skip to content

Commit 4c4f6cc

Browse files
committed
Use Homebrew SQLite if available
1 parent 2ebac2e commit 4c4f6cc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/sqlite_async/test/utils/native_test_utils.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ class TestSqliteOpenFactory extends TestDefaultSqliteOpenFactory {
2626
sqlite_open.open.overrideFor(sqlite_open.OperatingSystem.linux, () {
2727
return DynamicLibrary.open(sqlitePath);
2828
});
29+
30+
sqlite_open.open.overrideFor(sqlite_open.OperatingSystem.macOS, () {
31+
// Prefer using Homebrew's SQLite which allows loading extensions.
32+
const fromHomebrew = '/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib';
33+
if (File(fromHomebrew).existsSync()) {
34+
return DynamicLibrary.open(fromHomebrew);
35+
}
36+
37+
return DynamicLibrary.open('libsqlite3.dylib');
38+
});
2939
}
3040

3141
@override

0 commit comments

Comments
 (0)