rive-app / rive-app/rive-flutter

[Web] file_loader.dart:91 throws "Unexpected null value" in non-WASM builds

Open
#615 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Dart
Stars
1.5k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

Description

When building a Flutter web app without the --wasm flag (i.e., compiling to JavaScript via dart2js/DDC), loading a .riv file throws an Unexpected null value (TypeErrorImpl) at package:rive/src/file_loader.dart:91. The same .riv file loads and renders correctly when the app is built with --wasm.

This suggests a null-safety or platform-check issue in the JS (non-WASM) web runtime path — specifically in rive_native's web implementation (rive_web.dart:99) which propagates a null value up to file_loader.dart:91.

Rive animations should work regardless of whether the web build uses WASM or JavaScript compilation.

Steps To Reproduce
  1. Create a Flutter web app that uses a Rive animation via RiveAnimation.asset(...) or by loading a .riv file manually.
  2. Build/run with WASM: flutter build web --wasm — animation loads and works correctly.
  3. Build/run without WASM: flutter build web (or flutter run -d chrome) — the exception below is thrown at runtime when the .riv file is loaded.

Stack trace (abbreviated):

══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞══════════════════════
The following TypeErrorImpl was thrown:
Unexpected null value.

package:rive/src/file_loader.dart 91:23                 <fn>
package:rive_native/src/rive.dart 301:3                 <fn>
package:rive_native/src/web/rive_web.dart 99:1          <fn>
══════════════════════════════════════════════════════════════════
Source .riv/.rev file

We are unable to share the .riv file publicly as it is proprietary. The issue reproduces with our internal animation assets. We can privately share the file at hello@rive.app if needed — however, we believe this is a general JS-web-runtime issue rather than asset-specific, since the same file works perfectly under WASM.

Expected behavior

The .riv file should load and render successfully on Flutter web builds compiled to JavaScript (without --wasm), just as it does when compiled with --wasm. The Rive runtime should handle both web compilation targets without throwing null errors.

Screenshots

N/A — the error occurs during file loading, before any animation is rendered.

Device & Versions (please complete the following information)
  • Device: Chrome (Desktop web)
  • OS: macOS 25.3.0 (Darwin)
  • rive version: 0.14.3 (latest)
  • rive_native version: 0.1.3
  • Flutter Version:
Flutter 3.38.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 67323de285 (5 weeks ago) • 2026-01-28 13:43:12 -0800
Engine • hash 5eb06b7ad5bb8cbc22c5230264c7a00ceac7674b (revision 587c18f873)
Tools • Dart 3.10.8 • DevTools 2.51.1
  • Web compilation: dart2js / DDC (non-WASM)
Additional context
  • The issue is specifically a WASM vs. JS compilation discrepancy. When --wasm is passed to flutter build web, the Rive file loads fine. Without --wasm, the null error is thrown.
  • The null value originates in rive_native's web-specific code path (rive_web.dart:99), suggesting the JS interop or web runtime initialization returns null where the WASM path returns a valid object.
  • We are on the latest versions of both rive (0.14.3) and rive_native (0.1.3).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the non-WASM and WASM web paths around rive_native/src/web/rive_web.dart:99 and package:rive/src/file_loader.dart:91. Reproduce with flutter build web and flutter build web --wasm using an available .riv asset, then trace where the JS path produces null. Done means the same animation loads and renders successfully in the non-WASM build without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.