-
Notifications
You must be signed in to change notification settings - Fork 229
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
- Create a Flutter web app that uses a Rive animation via
RiveAnimation.asset(...)or by loading a.rivfile manually. - Build/run with WASM:
flutter build web --wasm— animation loads and works correctly. - Build/run without WASM:
flutter build web(orflutter run -d chrome) — the exception below is thrown at runtime when the.rivfile 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
--wasmis passed toflutter 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 returnsnullwhere the WASM path returns a valid object. - We are on the latest versions of both
rive(0.14.3) andrive_native(0.1.3).