Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: LateInitializationError: Field '_makeYogaStyle' has not been initialized. #389

Closed
naidu199 opened this issue May 12, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@naidu199
Copy link

naidu199 commented May 12, 2024

rootBundle.load(animationURL).then(
(data) {
final file = RiveFile.import(data); // error in this line

Encountering a LateInitializationError with the message "Field '_makeYogaStyle' has not been initialized."

The error message suggests an internal issue within the Rive library: "_makeYogaStyle" hasn't been initialized. This likely indicates a bug within the library's layout engine.

dubug message:
Error: LateInitializationError: Field '_makeYogaStyle' has not been initialized.
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3 throw
packages/rive_common/src/layout_engine_wasm.dart 7:20 get _makeYogaStyle
packages/rive_common/src/layout_engine_wasm.dart 527:36 makeLayoutStyle
packages/rive_common/layout_engine.dart 129:12 make
packages/rive/src/rive_core/layout_component.dart 28:48 new
packages/rive/src/generated/artboard_base.dart 123:7 new
packages/rive/src/rive_core/shapes/shape_paint_container.dart 77:1 new
packages/rive/src/rive_core/artboard.dart 681:17 new
packages/rive/src/runtime_artboard.dart 33:21 new
packages/rive/src/rive_file.dart 53:20 _readRuntimeObject
packages/rive/src/rive_file.dart 176:22 __
packages/rive/src/rive_file.dart 347:21 import
packages/animated_login/login_screen.dart 42:31
dart-sdk/lib/async/zone.dart 1661:54 runUnary
dart-sdk/lib/async/future_impl.dart 162:18 handleValue
dart-sdk/lib/async/future_impl.dart 838:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 867:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 643:5 [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 713:7 callback
dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7

@naidu199 naidu199 added the bug Something isn't working label May 12, 2024
@NashIlli
Copy link

+1

@vance-liu
Copy link

vance-liu commented May 17, 2024

+1
This problem occurs only on the web.

Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (4 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1

@untitledappseu
Copy link

+1 This problem occurs only on the web.

Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (4 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1

Nope it also happens to me on iOS.

@untitledappseu
Copy link

1+

@untitledappseu
Copy link

Getting the same issue on my iOS Emulator

@naidu199
Copy link
Author

+1 This problem occurs only on the web.

Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (4 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1

No, it also happened on Android

@vance-liu
Copy link

+1 This problem occurs only on the web.

Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (4 weeks ago) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1

No, it also happened on Android

I use rive 0.13.4, compiled and tested web, ios, macos, and android, only web has this problem.

@untitledappseu
Copy link

I fixed the problem by running flutter clean

@kuldeepsm
Copy link

Facing the same issue, LateInitializationError: Field '_makeYogaStyle' has not been initialized
this is a bug within a library. any possible solution here?

@vance-liu
Copy link

For me, this problem occurs on the web using the following code.

final bytes = await rootBundle.load(riveAsset!.path);
_file = RiveFile.import(bytes);

Change to the following code to resolve this issue.

_file = await RiveFile.asset(riveAsset!.path);

Maybe

RiveFile.import
RiveFile._

did not call the initialization function causing the problem.

@kuldeepsm
Copy link

For me, this problem occurs on the web using the following code.

final bytes = await rootBundle.load(riveAsset!.path);
_file = RiveFile.import(bytes);

Change to the following code to resolve this issue.

_file = await RiveFile.asset(riveAsset!.path);

Maybe

RiveFile.import
RiveFile._

did not call the initialization function causing the problem.

thanks @vance-liu, after changing this line, it's working fine for me

@naidu199
Copy link
Author

For me, this problem occurs on the web using the following code.

final bytes = await rootBundle.load(riveAsset!.path);
_file = RiveFile.import(bytes);

Change to the following code to resolve this issue.

_file = await RiveFile.asset(riveAsset!.path);

Maybe

RiveFile.import
RiveFile._

did not call the initialization function causing the problem.

thank you @vance-liu now it's working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants