Making things
Flutter 3D models: how Lovegotchi uses Three.js
Inside our Flutter 3D character implementation: bundled GLB models, a Three.js WebView, readiness messages and a render loop that can stop when hidden.

Lovegotchi puts a 3D character inside a Flutter app, but Flutter is not drawing that character's mesh. Our implementation uses a WebView running a bundled Three.js scene. Flutter supplies the surrounding interface and sends commands across a small bridge; the scene loads GLB assets and plays their animation clips.
That division is the useful answer if you are investigating Flutter 3D model animation. It is also only the beginning of a product implementation. Loading, readiness, visibility and the boundary between a scene and app state need explicit contracts. Here is how those boundaries appear in our source, with concrete examples rather than a claim that this is the best renderer for every app.
One pet, two rendering responsibilities
Mochi is the pet that exactly two people raise together. The official introduction to Mochi explains her character and stages. Here we are concerned with how that character fits inside a screen: a scene has to feel present without becoming responsible for every button, navigation decision and shared-state update around it.

The Flutter side has a MochiGlbView and an imperative MochiGlbController. The renderer lives in a separate JavaScript source module. That boundary lets the app ask for a named animation while leaving clip playback and scene rendering to Three.js. It does not require a browser scene to own the whole mobile interface.
View configuration and commandsLocal WebView + Three.js
GLB loading and animationMessages to Flutter
Loaded, finished, cue or error
Serve bundled assets from a loopback address
Our Mochi3DServer binds an HTTP server to the IPv4 loopback address and asks the operating system to choose an available port. It serves the composer page, the built JavaScript bundle and permitted bundled assets. Each registered view receives a configuration and a page URL; unregistering the view removes its configuration.
// Excerpt from mochi3d_server.dart
final server = await HttpServer.bind(
InternetAddress.loopbackIPv4, 0,
);
Loopback matters here: this is an address on the device, not our public website delivering every animation. The renderer's local asset path is separate from the network services used by a shared app. Bundling the scene therefore does not mean the entire Lovegotchi experience is an offline application.
This choice brings responsibilities. Asset routes need a defined scope, each view needs cleanup, and the WebView must receive a valid page configuration. A local server is an implementation component, not a reason to turn on broad remote navigation or accept arbitrary model URLs from users. Our example is an explanation of this boundary, not a complete server recipe to paste into another app.
Load the scene, then acknowledge readiness
On initialization, the Flutter view registers its configuration, creates a WebView controller, sets a transparent background, enables JavaScript and installs a message channel before loading the local page. The official webview_flutter documentation describes the underlying controller and platform WebView. Our scene contract sits on top of that API.
The JavaScript side uses GLTFLoader to load the configured model, creates an AnimationMixer for its scene and indexes the model's clips by name. These are Three.js concepts, not Flutter widget animations. The GLTFLoader reference documents the loader separately from our integration.
// Excerpt from the renderer; error handling omitted here.
mixer = new THREE.AnimationMixer(base.scene);
mixer.addEventListener('finished', onFinished);
for (const clip of base.animations) {
clips.set(clip.name, { clip });
}
Model bytes arriving is not the same thing as a complete visible character. Our renderer also composes the configured cosmetics before reporting readiness. The source documents the specific problem this avoids: capturing early loop frames before the cosmetic model arrived could show the character without that cosmetic. Readiness belongs after the composition the user should actually see.
The renderer sends a load message after composition and rendering. Its notification uses animation frames with a timer backup. Flutter marks the controller loaded when that message arrives. Calls through the controller before it is ready are dropped, so callers must use the loaded callback rather than assuming a command queue exists.
The Flutter message handler also distinguishes a reported WebGL failure from other renderer errors. A missing graphics context is not the same condition as a model that failed to load. The distinction gives recovery code a more useful signal than an indefinitely spinning indicator. In your own integration, name the stages you can observe: page initialized, environment created, model loaded, composition complete and first render ready. When a load stalls, the last completed stage is more actionable than a single undifferentiated timeout.
Keep commands small and outcomes explicit
The bridge exposes operations such as play, pause, resume and set-active. Animation commands name a clip and can specify repetition or restarting. In the opposite direction, the renderer can report a completed clip, a cue or an error. Flutter can then decide what the surrounding experience should do.
This is a useful distinction when animation accompanies an action. A character finishing a clip does not, by itself, prove that a shared operation was accepted. The shared-care product overview describes the experience both people participate in; the renderer remains one presentation component within that experience.
For another project, write down those messages before adding effects. Define whether an early command is queued, rejected or ignored. Define whether a completion message can arrive after a view has been disposed. Define what the app shows if WebGL initialization fails. The contract is easier to reason about when it has a few named states instead of an unstructured collection of JavaScript calls.
A hidden scene needs a different clock
The renderer has an active flag. Once loading has completed, the frame loop exits when that flag is false. When activated again, it restarts animation frames and discards the clock delta accumulated while stopped. Otherwise, a resumed animation could advance by the time spent hidden rather than continuing naturally.
Other explicit limits include capping the renderer's pixel ratio at two, skipping render work when the scene is not dirty, and scheduling the contact-shadow update less often during animation. These are code-level decisions about work. They are not measured guarantees of a particular frame rate or battery improvement on a phone.
This is where a prototype and a product diverge. A prototype can look convincing while its only visible screen is open. A product also has covered screens, navigation, backgrounding, context loss and disposal. Visibility controls need callers, and those transitions need device testing. The presence of a pause method alone would not establish that every lifecycle path is correct.
What to take into your own prototype
Start with one bundled model, one idle clip and a clearly bounded scene area. Add the loading handshake before connecting care controls. Test a command before readiness, a view removed during loading, hiding and showing the scene, a missing asset and a renderer error. Keep the surrounding controls understandable while any of those states is happening.
Choose a renderer after considering the interaction you need, your asset pipeline and the devices you intend to support. This case study does not establish that a WebView beats native rendering or a game engine. It shows one concrete way we separate Flutter interface work from a 3D scene, and the contracts needed to make that separation usable.
The next boundary is between people rather than renderers. Our two-person app UX case study examines invitation validation and shared-state feedback. Those concerns remain even after the pet looks right on screen.

