flutter_scene
0.24.3, released 6 weeks ago by bdero.dev
A 3D game engine for Flutter built on Flutter GPU with PBR lighting and glTF support.
What it does
Renders 3D scenes, glTF models, and geometries with PBR lighting, shadows, physics, and animation using Flutter GPU. It runs on mobile, desktop, and the web, and includes a desktop scene editor and asset pipeline.
AI-written summary of version 0.24.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to build 3D games or interactive graphics experiences within Flutter.
- You need glTF model rendering with PBR lighting and shadows across all Flutter platforms.
Skip it when
- You only need standard 2D UI layouts and standard Flutter widgets.
- You are running on Flutter versions that do not support Flutter GPU or you cannot enable it.
Strengths
- Built on Flutter GPU for native-tier performance across mobile, desktop, and web.
- Supports PBR materials, physics, positional audio, and skeletal animation.
- Includes a build-time asset pipeline for optimization and a scene editor.
Weaknesses
- Requires enabling Flutter GPU flags and specific platform setup.
- Asset pipeline and shader compilation require build hooks.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 16
Requires running `dart run flutter_scene:init`, enabling Flutter GPU in platform configuration files or command-line flags, and Flutter 3.47.1+ for some native targets.
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();
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)),
);
}
}Alternatives
Packages that do the same job and could replace flutter_scene.
Works with
Packages commonly used together with flutter_scene: ones it builds on, ones built on it, and its own family.
- yamlflutter_scene depends on itA Dart library for parsing YAML documents into Dart data structures.
- webflutter_scene depends on itLightweight bindings for browser APIs via JS interop
- clockflutter_scene depends on itA fakeable wrapper for dart:core clock APIs.
- hooksflutter_scene depends on itDart API for the JSON-based protocol for package build and link hooks.
- code_assetsflutter_scene depends on itProvides the hook protocol specification for bundling native code with Dart packages.
- argsflutter_scene depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- loggingflutter_scene depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- vector_mathflutter_scene depends on itVector math library for 2D/3D/4D vectors, matrices, quaternions, and geometry.