Skip to content

Remove ViewConfiguration and PlatformConfiguration from dart:ui #121742

@goderbauer

Description

@goderbauer

Both the PlatformDispatcher [1] and the FlutterView [2] are backed by immutable configuration objects: ViewConfiguration [3] and PlatformConfiguration [4]. They both have a configuration getter [5][6] that exposes the configuration object. At the same time, they implement convenience getter to retrieve values from the configuration: e.g. instead of calling FlutterView.viewConfiguration.devicePixelRatio one can call FlutterView.devicePixelRatio directly. This is true for all other values exposed by the configuration as well.

AFAIK, this setup doesn't provide us with any benefits and just adds more complexity through indirection: There are two ways to do the same things and when it comes to testing and mocking it is more complicated to keep the mock value on the FlutterView in sync with the same value exposed by its configuration.

Proposal: Let's simplify this by removing the ViewConfiguration and PlatformConfiguration classes as well as the FlutterView.viewConfiguration and PlatformConfiguration.configuration getters from the public interface of dart:ui and instead always use the getters on FlutterView or PlatformDispatcher directly to obtain these values.

[1] https://master-api.flutter.dev/flutter/dart-ui/FlutterView-class.html
[2] https://master-api.flutter.dev/flutter/dart-ui/PlatformDispatcher-class.html
[3] https://master-api.flutter.dev/flutter/dart-ui/ViewConfiguration-class.html
[4] https://master-api.flutter.dev/flutter/dart-ui/PlatformConfiguration-class.html
[5] https://master-api.flutter.dev/flutter/dart-ui/FlutterView/viewConfiguration.html
[6] https://master-api.flutter.dev/flutter/dart-ui/PlatformDispatcher/configuration.html

Metadata

Metadata

Assignees

Labels

engineflutter/engine related. See also e: labels.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions