Skip to content

[breaking change] Make dart:io Platform abstract #52444

Closed
@brianquinlan

Description

@brianquinlan

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 a lineTerminator property that obviates the need for the extension in package: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

area-metaCross-cutting, high-level issues (for tracking many other implementation issues, ...).breaking-change-approvedbreaking-change-requestThis tracks requests for feedback on breaking changes

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions