dict_reader 1.1.4 copy "dict_reader: ^1.1.4" to clipboard
dict_reader: ^1.1.4 copied to clipboard

Reading mdict files, support MDX/MDD file formats. It can simplify your writing of mdict-based dictionary software.

example/README.md

Example #

English | 中文

Read Data Directly #

import 'package:dict_reader/dict_reader.dart';

void main() async {
  final dictReader = DictReader("MDX FILE PATH");
  await dictReader.init();

  await for (final (keyText, data) in dictReader.read(true)) {
    print("$keyText, $data");
  }
}

Read Data Offset, Read Data Later #

import 'package:dict_reader/dict_reader.dart';

void main() async {
  final dictReader = DictReader("MDX FILE PATH");
  await dictReader.init();

  final map = <String, (int, int, int, int)>{};
  await for (final (keyText, offset) in dictReader.read()) {
    map[keyText] = offset;
  }

  final offset = map["go"];
  print(await dictReader.readOne(offset!.$1, offset.$2, offset.$3, offset.$4));
}

Read Data After Stored Data Offset #

import 'package:dict_reader/dict_reader.dart';

// ...

void main() async {
  // ...

  final dictReader = DictReader("MDX FILE PATH");
  // Pass false to reduce initialization time
  await dictReader.init(false);

  final offset = map["go"];
  print(await dictReader.readOne(offset!.$1, offset.$2, offset.$3, offset.$4));
}
2
likes
160
pub points
63%
popularity

Publisher

verified publishermumulhl.eu.org

Reading mdict files, support MDX/MDD file formats. It can simplify your writing of mdict-based dictionary software.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

blockchain_utils, charset

More

Packages that depend on dict_reader