Breaking change 52027: Make dart:io FileSystemEvent sealed

109 views
Skip to first unread message

Brian Quinlan

unread,
Apr 12, 2023, 8:23:47 PM4/12/23
to anno...@dartlang.org
Change Intent

Make FileSystemEvent sealed.

Justification

It would be nice to be able to exhaustively pattern match on the events produced by FileSystemEntity.watch so FileSystemEvent should be sealed.

Impact

Code targeting Dart 2 will not be able to implements or extends FileSystemEvent (FileSystemEvent is final so Dart 3 code already cannot implement or extend it).

The only known package that implements a FileSystemEvent is package:watcher, which I will fix.

In Dart 3.0.0, the constructors for FileSystemEvent subclasses are public so the only obvious reason for implementing a FileSystemEvent is gone.

Mitigation

Code that implements or extends FileSystemEvent will need to be modified but the modification is straightforward i.e. use the new public constructors for those classes instead of creating your own subclasses.

Please make comments on this issue:
https://github.com/dart-lang/sdk/issues/52027
Reply all
Reply to author
Forward
0 new messages