dependencies:
sqflite_common_ffi: any
//in main.dart write this:
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
Future main() async {
// Initialize FFI
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
runApp(MyApp());
}
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sqflite/sqflite.dart';
Future main() async {
if (Platform.isWindows || Platform.isLinux) {
// Initialize FFI
sqfliteFfiInit();
}
// Change the default factory. On iOS/Android, if not using `sqlite_flutter_lib` you can forget
// this step, it will use the sqlite version available on the system.
databaseFactory = databaseFactoryFfi;
runApp(MyApp());
}
sqlite - DatabaseFactory not initialized when using sqflite in flutter - Stack Overflow