-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Description
After updating to Flutter 3.27.1 and Dart 3.6.0, I encountered a compilation error when trying to build my Flutter project with rive_common-0.4.15. The error message indicates that _YGValue must be marked as base, final, or sealed because it extends Struct.
flutter pub-cache/hosted/pub.dev/rive_common-0.4.15/lib/src/layout_engine_ffi.dart:174:7: Error: The type '_YGValue' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'.
This issue appears to be related to recent changes in Dart's handling of FFI structs.
Steps To Reproduce
- Create a Flutter project with
rive_common-0.4.15. - Run
flutter buildorflutter run. - Observe the compilation error in
layout_engine_ffi.dart.
Expected behavior
The project should compile successfully without errors.
Workaround
I was able to resolve the issue locally by modifying _YGValue in layout_engine_ffi.dart and marking it as final:
final class _YGValue extends Struct {After applying this change, the project compiled successfully without errors. However, this is just a temporary fix, and an official update in the package would be appreciated.
Device & Versions
- Device: MacBook M3 Pro
- OS: macOS 15.3
- Flutter Version:
Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision 17025dd882 (8 weeks ago) • 2024-12-17 03:23:09 +0900 Engine • revision cb4b5fff73 Tools • Dart 3.6.0 • DevTools 2.40.2
Additional context
This issue may be due to Dart 3.6 enforcing stricter constraints on FFI structures. It would be helpful if rive_common could update its codebase to be compatible with the latest Dart versions.
Would appreciate guidance on whether this fix should be incorporated officially.