internalMenkDBInit function

void internalMenkDBInit()

init Menksoft old code word database for platform other than web.

Implementation

void internalMenkDBInit() async {
  if (menkDB == null) {
    final documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "menk_ime.db");
    if (FileSystemEntity.typeSync(path) == FileSystemEntityType.notFound) {
      ByteData data =
          await rootBundle.load('packages/menk_embed_ime_db/db/menk_ime.db');
      final bytes =
          data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
      await File(path).writeAsBytes(bytes);
    }
    menkDB = sqlite3.open(path);
  }
}