29 lines
751 B
Dart
Executable File
29 lines
751 B
Dart
Executable File
import 'package:flutter/foundation.dart';
|
|
import 'package:sqflite/sqflite.dart';
|
|
import 'package:translator_lux/dataBase/table/translator_history_table.dart';
|
|
|
|
class TranslatorDataBase {
|
|
static Database? thDB;
|
|
static String dataBaseName = "translator.db";
|
|
|
|
static init() async {
|
|
String path = await getDatabasesPath();
|
|
path = "$path/$dataBaseName";
|
|
debugPrint(path);
|
|
await openDatabase(
|
|
path,
|
|
version: 1,
|
|
onCreate: (db, version) async {
|
|
debugPrint("dataBase create success");
|
|
await TranslatorHistoryTable.createTable(db);
|
|
debugPrint("dataTable create success");
|
|
},
|
|
).then(
|
|
(value) {
|
|
thDB = value;
|
|
TranslatorHistoryTable.init(value);
|
|
},
|
|
);
|
|
}
|
|
}
|