sceneBindSources function

SceneBindSources sceneBindSources(
  1. SceneDocument doc,
  2. SceneNode node,
  3. String key
)

Implementation

SceneBindSources sceneBindSources(
  SceneDocument doc,
  SceneNode node,
  String key,
) {
  if (resolveSceneKey(node, key)?.prop.kind == ScenePropKind.style) {
    return SceneBindSources(
      tokens: [
        for (var t in doc.tokens)
          if (t.isStyle && t.hasValue) t,
      ],
      exports: [
        for (var t in doc.tokens)
          if (t.isStyle && t.isExport) t,
      ],
    );
  }
  var kind = bindableKind(node, key);
  if (kind == null) return const SceneBindSources();
  return SceneBindSources(
    canPromote: true,
    params: [
      for (var p in doc.params)
        if (p.kind == kind) p,
    ],
    tokens: [
      for (var t in doc.tokens)
        if (t.kind == kind && t.hasValue) t,
    ],
    exports: [
      for (var t in doc.tokens)
        if (t.kind == kind && t.isExport) t,
    ],
  );
}