Hello,
First, thanks a lot for this library which is working fine for me on Android and Linux.
I'm trying to make a Windows release and I can do it but only if I add in the root folder a .packages
file containing sqflite_common_ffi:lib/
(the lib/
folder being as this: lib/src/windows/sqlite3.dll
(<=> the sqlite dll found in C:\Users\{USERNAME}\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\sqflite_common_ffi-1.1.1+1
You can find an example of my project below:
- It is working when I add all the elements
- If I try to modify the
lib/src/windows/sqlite3.dll
path or the .packages
file, the application is showing nothing
Note that it also works perfectly fine if my release folder in under {FLUTTER_PROJECT}/build/windows/runner/Release/
and without any .packages
nor lib/src/windows/sqlite3.dll
(I guess the app is searching in 'prefolders' and finds the .packages
(and then the sqlite dll file in AppData)
=> To reproduce, you need put the windows executable outside your flutter project !
Here is my pubspec.yaml
dependencies:
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# Show HTML content
flutter_html: ^1.1.1
# Icons
cupertino_icons: ^1.0.0
# API requests
http: ^0.12.2
# Internal storage
sqflite: ^1.3.2
path_provider: ^1.6.24
# Share content outside the application
share: ^0.6.5
# Ads
admob_flutter: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
# Internal storage
sqflite_common_ffi: ^1.1.1
# Searchable dropdown list
# TODO: Use official version when this issue will be solved: https://github.com/icemanbsi/searchable_dropdown/issues/117
searchable_dropdown:
git:
url: https://github.com/FunnyLabz/searchable_dropdown.git
ref: master
Here is how I initialized the project:
// Platform
import 'package:flutter/foundation.dart';
// For database handling
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sqflite/sqflite.dart';
void main() {
if ((defaultTargetPlatform == TargetPlatform.windows || defaultTargetPlatform == TargetPlatform.linux) && !kIsWeb) {
// Initialize FFI to be able to use database with Windows/Linux
// We use 'sqflite_ffi' if Linux or Windows, else we can use default sqlite (Android/IOS/Mac)
sqfliteFfiInit();
// Change the default factory
databaseFactory = databaseFactoryFfi;
}
runApp(new MyApp());
}