bdero/flutter_scene/flutter-scene-idioms

Claude Code and agent skill by bdero/flutter_scene

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Write correct flutter_scene code. Use this whenever building 3D with the flutter_scene Dart/Flutter engine (rendering a scene, geometry, materials, lighting, loading a .glb model, animation, custom shaders). It corrects the wrong assumptions models carry from three.js, Godot, and Unity, and names the APIs and traps that are specific to this engine.

Install

npx vskill@latest install bdero/flutter_scene/flutter-scene-idioms

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as bdero/flutter_scene/flutter-scene-idioms.

Building with flutter_scene

flutter_scene is a realtime 3D engine for Flutter, built on Flutter GPU. It has a retained scene graph (Scene holds Nodes, nodes carry a Mesh), physically based materials, image-based lighting, and a deep post-processing stack.

The one thing to internalize: this is not three.js, Godot, or Unity, and the API diverges from all three in specific ways. Most first-attempt failures come from reaching for another engine's spelling. The corrections below are the highest-value part of this skill; read them before writing code.

Do not reach for these (they do not exist or will break the build)

  • Not the master channel. flutter_scene runs on Flutter 3.47 stable or newer. Do not run flutter channel master; it resolves worse, not better.
  • Not `--enable-impeller`, not `--enable-experiment=native-assets`. The run flag is `--enable-flutter-gpu` and nothing else. --enable-experiment=native-assets actively breaks the build on Dart 3.10+.
  • Not `package:vector_math/vector_math_64.dart`. flutter_scene uses `package:vector_math/vector_math.dart`. The _64 types are a different, incompatible Vector3.
  • Not `Node.fromAsset(...)`, not `loadModel(...)`. Load a preprocessed model with `loadScene('assets/x.glb')` (returns Future<Node>), or a runtime glTF with Node.fromGlbAsset / Node.fromGlbBytes.
  • Not a hand-rolled `CustomPainter` + `Ticker`. Display a scene with the `SceneView` widget; it drives the per-frame loop for you.
  • Not `node.position.set(x, y, z)`. See transforms below.
  • Not `forward.cross(up)` for a camera or node right vector. View space is left-handed (+Z forward into the screen, +Y up, +X right), while vector_math's cross is right-handed, so forward.cross(up) points screen-left and horizontally inverts A/D strafing and drag panning. Read camera.right, camera.horizontalRight, or node.right, or compute up.cross(forward).normalized().
  • Not `.model` files or `buildModels`. The offline format is .fsceneb, produced by the flutter_scene:init build hook; you load it by source path with loadScene.
  • Not the removed `Environment` class. Environment lighting is EnvironmentMap on Scene.environment.

Setup

sh
flutter pub add flutter_scene
dart run flutter_scene:init # installs the build hook, sets up assets
flutter run --enable-flutter-gpu # native; add -d chrome for web

flutter_scene:init is required setup, not optional. Rendering is gated on Scene.initializeStaticResources(); until it completes the engine prints "Flutter Scene is not ready to render. Skipping frame." If that load fails (a web build that could not fetch its shader bundle, say), a SceneView with an errorBuilder: (context, error, retry) shows it and calls retry() when the app chooses; nothing retries on its own, and without an errorBuilder the view reports the error and stays on its loading widget.

Minimal scene (this compiles as-is)

dart
import 'package:flutter/material.dart';
import 'package:flutter_scene/scene.dart';
import 'package:vector_math/vector_math.dart' as vm;
void main() => runApp(const MaterialApp(home: CubeView()));
class CubeView extends StatefulWidget {
const CubeView({super.key});
@override
State<CubeView> createState() => _CubeViewState();
}
class _CubeViewState extends State<CubeView> {
final Scene scene = Scene();
bool ready = false;
@override
void initState() {
super.initState();
// Geometry and materials touch the shader bundle, so build them only
// after the engine's static resources are up.
Scene.initializeStaticResources().then((_) {
scene.add(Node(
mesh: Mesh(CuboidGeometry(vm.Vector3(1, 1, 1)), PhysicallyBasedMaterial()),
));
if (mounted) setState(() => ready = true);
});
}
@override
Widget build(BuildContext context) {
if (!ready) return const SizedBox.expand();
return SceneView(scene, camera: PerspectiveCamera(position: vm.Vector3(2, 2, -4)));
}
}

An unset Scene.environment still gives image-based lighting (a default studio map is resolved at render), so a bare PhysicallyBasedMaterial() is lit without any light setup.

Choosing declarative or imperative

flutter_scene has two ways to build a scene, and picking the wrong one is a structural decision that is expensive to undo later. Choose up front by what the app does, not by which reads nicer.

Declarative (inline widgets). Describe the scene as Flutter widgets under SceneView.declarative(children: [...]), using SceneMesh, SceneNode, and SceneModel. Flutter's own rebuild diffing keeps the rendered scene in sync with your widget state, the same way it keeps the UI in sync. Reach for this when app state maps cleanly onto a fixed set of objects on screen and nothing is simulation-like, for example a product configurator where a few SceneMeshes track some setState values.

Imperative (retained scene graph). Own a Scene, add Nodes, attach Components, and display it with SceneView(scene, camera: ..., onTick: ...). Track state the way you would in another game engine. The cleanest shape is a plain Dart Game class that owns the Scene and holds the game state, with the scene build and per-frame tick routed into it, and behavior living in custom Components attached to nodes that the engine runs through the component lifecycle hooks. Reach for this for anything with real simulation.

Go imperative when the scene has complex physics, network replication, a character walking around, or procedural generation. Any one of these means imperative. Stay declarative when state maps directly to a fixed set of shown objects and nothing ticks or simulates.

The two interoperate. A mostly-declarative scene can drop to an imperative node where it needs one, and an imperative scene can mount declarative subtrees. See references/architecture.md for the Game-class pattern, component-driven nodes, and the hybrid seam.

The API shape (where it diverges from what you expect)

Transforms. Node has position, rotation (a Quaternion), and scale, but they are whole-value get/set, not the mutable spelling other engines use. Assign the whole vector (node.position = vm.Vector3(0, 1, 0) or node.position += ...). The getters return copies, so node.position.x = 5 does nothing and throws in debug. For a raw matrix edit use node.localTransform = matrix or node.mutateLocalTransform((m) => m.translateByVector3(...)); a bare in-place edit of node.localTransform never moves the node, because the cache is not told. node.forward, node.right, and node.up return the node's unit world-space basis axes (+Z, +X, +Y), and node.lookAt(target) or node.lookAtFrom(eye, target) aims local +Z at target.

Geometry. Ten built-in primitives (CuboidGeometry, SphereGeometry, IcosphereGeometry, CylinderGeometry with separate top/bottom radii so cones are free, CapsuleGeometry, TorusGeometry, PlaneGeometry, DiscGeometry, RingGeometry, WedgeGeometry), plus swept geometry (ExtrudeGeometry, TubeGeometry, RibbonGeometry), lines (PolylineGeometry), and GeometryBuilder/MeshData for custom meshes. Do not hand-pack a ByteData vertex buffer before checking these.

Materials. PhysicallyBasedMaterial (base color, metallic, roughness, normal, emissive, plus clearcoat/sheen/transmission/etc.), UnlitMaterial, ShaderMaterial for custom shaders. Texture slots take a TextureSource (from loadTexture(path)), not a raw gpu.Texture.

Camera and coordinate basis. PerspectiveCamera(position: ..., target: ...), or OrthographicCamera(position: ..., target: ..., projection: OrthographicProjection(size: OrthographicSize.height(12))) for isometric, top-down, and pixel-art views. Every depth effect works under both. Prefer attaching OrbitCameraController, FollowCameraController, or FlyCameraController to a camera node (driven with the CameraControls widget) over hand-rolling spherical camera math. When driving a camera yourself, remember that view space is left-handed (`+Z` forward into the screen, `+Y` up, `+X` right).

  • Default camera placement sits on the -Z side ((0, 0, -5)) looking along +Z at the origin, where world +X points screen-right. If you instead place an eye on the +Z side (eye = target + vm.Vector3(d * sin(a), y, d * cos(a))) looking back along -Z, world +X points screen-left (right = vm.Vector3(-cos(a), 0, sin(a))), not (cos(a), 0, -sin(a)).
  • Never write forward.cross(up) for a right vector; vector_math's right-handed cross product makes forward.cross(up) point screen-left. Read camera.right (or camera.horizontalRight and camera.horizontalForward for XZ ground-plane strafing and panning) or compute up.cross(forward).normalized().

What you are probably underestimating (it is all here)

Models trained on older or thinner information assume flutter_scene has no lighting, no shadows, and no post-processing. It has all of it. Before hand-rolling any of these, know they exist: directional/point/spot/area lights, shadows (PCSS, contact shadows), GTAO ambient occlusion, screen-space reflections, parallax-corrected reflection probes, SSGI, an irradiance probe field (screen-space or compute ray-traced), depth of field, god rays, fog, auto exposure, LUT color grading, bloom, lens flares, MSAA/SMAA/FXAA, tone mapping, instancing, LOD. See references/what-exists.md for the full surface with the class names.

Low-end and GLES-class GPUs (Raspberry Pi, web, integrated Linux) get a budget, not a different engine: scene.renderQuality.tier (RenderQualityTier.low, medium, high; null picks the platform default) decides what AntiAliasingMode.auto and the scene color capture budget resolve to, and scene.renderQuality.adaptive = true lowers the render scale and then the tier from measured frame periods when frames overrun targetFrameRate. Transmissive (glass) materials are the expensive thing on such devices; scene.sceneColorCaptureBatches = 1 makes them all share one capture.

Traps that fail silently (wrong pixels, no error)

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
806
Repository forks
88
7-day trend score
38

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/bdero/flutter_scene/flutter-scene-idioms/badge)](https://verified-skill.com/skills/bdero/flutter_scene/flutter-scene-idioms)

Something wrong with this skill or its page? Tell us.