EN | RU
sqflite_aurora
README of the original plugin.
Description
The Flutter plugin demonstrates working with the SQLite database and is an interface for the sqflite package.
Usage example:
import 'package:sqflite/sqflite.dart';
// Init database
Future<String?> init() async {
var databasesPath = await getDatabasesPath();
String path = p.join(databasesPath, _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
Add the plugin to your target application dependencies in the pubspec.yaml file:
dependencies:
sqflite: ^2.4.1
sqflite_aurora:
git:
url: https://hub.mos.ru/auroraos/flutter/flutter-community-plugins/sqflite_aurora.git
And update the dependencies:
flutter pub get
For Aurora OS specifically, use:
flutter-aurora pub get
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.