小编seo*_*joo的帖子

如何在 Dart 中检查 Stream 的结束?

各位 Dart 程序员。

我正在使用 Stream 读取文件,如下所示。

Stream<List<int>> stream = new File(filepath).openRead();
stream
    .transform(UTF8.decoder)
    .transform(const LineSpilitter())
    .listen((line){
        // TODO: check if this is the last line of the file
        var isLastLine;
    });
Run Code Online (Sandbox Code Playgroud)

我想检查listen()中的行是否是文件的最后一行。

dart dart-async

5
推荐指数
1
解决办法
3359
查看次数

标签 统计

dart ×1

dart-async ×1