BackendOpener typedef

BackendOpener = Future<GraphicsDevice> Function(DeviceRequest request)

Opens a GraphicsDevice for request, or throws.

The one shape of opening, on every backend, since 1.0: asynchronous, and given the size of the surface it starts at. A backend that sizes its targets per frame (Impeller) takes the size and is not held to it; one that cannot (the software rasteriser, WebGL2's canvas) draws at it.

One DeviceRequest, since 1.0.0-rc.1, where it was a width and a height as named parameters: an opener is a function type every backend assigns to, so a parameter added later would make every open written before it unassignable. A field with a default on the request breaks nobody, and a backend that does not read it is still asked for what it says: the registry holds the device open answers to DeviceRequest.checkSatisfiedBy.

Implementation

typedef BackendOpener = Future<GraphicsDevice> Function(DeviceRequest request);