Closed
Description
Change Intent
Add the abstract
class modifier to the dart:io
Platform
class.
Justification
Platform
only has static
properties so there is no reason to make instances of it.
Impact
All code that constructs Platform
(i.e. Platform()
) will break. There is one known pattern where this is done: package:dcli
implements a non-static extension on Platform
to allow users to get the line ending for the platform i.e.
Platform().eol;
Mitigation
In Dart 3.1:
- The constructor for
Platform
is deprecated. Platform
contains alineTerminator
property that obviates the need for the extension inpackage:dcli
.
Before we mark Platform
as abstract
, I will remove the extension
from package:dcli
and give users some time to update their dependencies. Making the change in Dart 3.2 would give users an approximately 6 week period to update their dependencies and code.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Complete