观察Dart中的文件更改 [英] Watch for file changes in Dart

查看:225
本文介绍了观察Dart中的文件更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Dart中观看文件更改(删除,创建,编辑),例如NodeJS?

Is it possible to watch for file changes (deletion, creation, edit) in Dart, like in NodeJS?

我似乎无法找到

推荐答案

你想看看 FileSystemEntity.watch()方法。然而由于平台差异,一些平台提供比其他平台更好的支持。特别是,在Windows上,您只能观看目录,而不只是一个单独的文件。在Linux上,您可以观看文件或目录,但不能递归地观看目录。

You want to take a look at FileSystemEntity.watch() method. However due to platform differences some platforms provide better support than others. In particular, on Windows you can only watch a Directory, and not just an individual file. On Linux you can watch Files or Directories but not recursively watch Directories. And MacOS supports all of the above.

还有一个 watcher package on Pub,但是目前我找不到与此包相关联的API文档的任何引用。

There is also a watcher package on Pub, however at this time I cannot find any reference to the API documentation associated with this package.

这篇关于观察Dart中的文件更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆