dart-lang / watcher

A file system watcher library for Dart.
https://pub.dev/packages/watcher
BSD 3-Clause "New" or "Revised" License
138 stars 35 forks source link

It will cause huge heat on iOS #150

Open qq1050603252 opened 1 year ago

qq1050603252 commented 1 year ago

It will cause huge heat on iOS,when I watch a directory full of music. Once the player plays the music in the watched directory, the device will generate huge heat. (system: iOS 16.6)

natebosch commented 1 year ago

I'm not sure if we have support for anything other than the polling watcher on iOS. I'd certainly expect a polling watcher on a very large directory to at least be keeping the CPU busier than it needs to be and have an impact on battery life.

I don't know if iOS supports file watching in Dart - what does isWatchSupported retur on that platform? https://api.dart.dev/stable/3.1.2/dart-io/FileSystemEntity/isWatchSupported.html

If iOS does support file watching, it would take a new implementation to use it. That could be a custom implementation outside the package and passed to registerCustomWatcher. https://pub.dev/documentation/watcher/latest/watcher/registerCustomWatcher.html

It's unlikely the Dart team will implement an iOS version. We could consider accepting a contributed implementation if the author has a plan for setting up testing on CI.

natebosch commented 1 year ago

FWIW, as is I would not recommend using this package on iOS.