GlassTierPolicy class Cost and policy

Turns whatever an application knows into one rung.

Every input is a declaration: the package detects none of them. The policy exists because the signals arrive from three unrelated places and the order they resolve in is a decision — see GlassTierReason.pinnedByHost for the one that is not obvious.

The order is pinned, then reduceTransparency, then ceiling, then the default:

inputs choose returns
nothing GlassTier.full, GlassTierReason.byDefault
ceiling: GlassTier.cheap GlassTier.cheap, GlassTierReason.deviceCeiling
reduceTransparency: true GlassTier.opaque, GlassTierReason.reduceTransparency
pinned: GlassTier.full, reduceTransparency: true GlassTier.full, GlassTierReason.pinnedByHost

The reduce-transparency flag is the application's to read: Flutter does not carry it (see GlassTierReason.reduceTransparency).

GlassHost(
  tier: GlassTierPolicy(
    reduceTransparency: platformSaysReduceTransparency,
    ceiling: isLowEndDevice ? GlassTier.cheap : null,
  ).choose(),
  child: const MyScreen(),
)

See also:

Annotations

Constructors

GlassTierPolicy({GlassTier? pinned, bool reduceTransparency = false, GlassTier? ceiling})
A policy from whatever the application knows. With no arguments it chooses GlassTierChoice.byDefault.
const

Properties

ceiling → GlassTier?
The richest rung this device should run, if the application has worked that out — by its own benchmark, its own device table, or a user setting.
final
hashCode → int
The hash code for this object.
no setteroverride
pinned → GlassTier?
The rung the host named. Overrides everything below it.
final
reduceTransparency → bool
The platform's reduce-transparency switch, as the application read it.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

choose() → GlassTierChoice
Resolves the three inputs into one rung, in the order pinned, reduceTransparency, ceiling.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override