diff --git a/lib/src/widget.dart b/lib/src/widget.dart index ab56541..82b3882 100755 --- a/lib/src/widget.dart +++ b/lib/src/widget.dart @@ -46,7 +46,9 @@ class _CubeState extends State { void initState() { super.initState(); scene = Scene( - onUpdate: () => setState(() {}), + onUpdate: () { + if (mounted) setState(() {}); + }, onObjectCreated: widget.onObjectCreated, ); // prevent setState() or markNeedsBuild called during build