isSceneDefault function

bool isSceneDefault(
  1. SceneProp p,
  2. Object? value
)

Whether value is what the property holds by default — the test that decides whether it is written at all.

Implementation

bool isSceneDefault(SceneProp p, Object? value) => switch (p.kind) {
  // A list is never `==` another list with the same contents, so the test is
  // emptiness — which is what every list property's default is.
  ScenePropKind.sizes || ScenePropKind.layers =>
    (value! as List).isEmpty && (p.defaultValue! as List).isEmpty,
  // A map is not `==` another with the same entries either.
  ScenePropKind.axes => (value! as Map).isEmpty,
  _ => value == p.defaultValue,
};