EN | RU
sqlite3_flutter_libs_aurora
README of the original plugin.
Description
The Flutter plugin demonstrates the ability to connect a compiled SQLite library to a project in cases where the system version is not suitable for development. The plugin requires the sqflite_common_ffi and sqlite3 packages to work.
Usage example:
import 'package:sqlite3/sqlite3.dart' hide Database;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
// Init database
Future<String?> init() async {
// Set up databaseFactory by databaseFactoryFfi for sqflite_common_ffi
databaseFactory = databaseFactoryFfi;
var databasesPath = await getApplicationSupportDirectory();
String path = p.join(databasesPath.path, _name);
_db = await openDatabase(
path,
version: 1,
onCreate: (Database db, int version) async {
await db.execute('CREATE TABLE $_table (val_str TEXT)');
},
);
return await select();
}
// Get value from Database
Future<String?> select() async {
final rows = await _db?.rawQuery('SELECT rowid as id, * FROM $_table');
if (rows != null && rows.isNotEmpty && rows[0].containsKey('id')) {
return rows[0]['val_str'].toString();
}
return null;
}
// Set value to Database
Future<void> insert(String value) async {
await _db?.transaction((txn) async {
await txn.rawInsert('INSERT INTO $_table(val_str) VALUES(?)', [value]);
});
}
// Close database
Future<void> close() async {
await _db?.close();
}
Contents
- Installation and build
- Detailed description
- Compatibility
- Terms of use and participation in development
Installation and build
Add the plugin to your target application dependencies in the pubspec.yaml file:
dependencies:
sqflite_common_ffi: ^2.0.0
sqlite3: ^2.5.0
sqlite3_flutter_libs_aurora:
git:
url: https://hub.mos.ru/auroraos/flutter/flutter-community-plugins/sqlite3_flutter_libs_aurora.git
And update the dependencies:
flutter pub get
For Aurora OS specifically, use:
flutter-aurora pub get
Detailed description
This version of the plugin uses the SQLite 3.51.1 build.
Compatibility
The plugin works correctly starting from Aurora OS version 5.1.
Terms of Use and Participation
The project source code is provided under the license that allows its use in third-party applications.
To participate in project development, please read the contributor agreement. If you plan to contribute your own source code to the project, you will need to accept the CLA agreement.
For information about contributors see AUTHORS.
Code of conduct is a current set of rules of the Open Mobile Platform which informs you how we expect the members of the community will interact while contributing and communicating.