-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
114 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Example | ||
|
||
English | [中文](./README_CN.md) | ||
|
||
## Read Data Directly | ||
|
||
```dart | ||
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 | ||
|
||
```dart | ||
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 | ||
|
||
```dart | ||
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)); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 示例 | ||
|
||
[English](./README.md) | 中文 | ||
|
||
## 直接读取数据 | ||
|
||
```dart | ||
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"); | ||
} | ||
} | ||
``` | ||
|
||
## 读取数据 offset,之后读取数据 | ||
|
||
```dart | ||
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)); | ||
} | ||
``` | ||
|
||
## 当已保存数据 offset,读取数据 | ||
|
||
```dart | ||
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)); | ||
} | ||
``` |