Currently, when ThorVG.flutter performs animation rendering via FFI, the main UI thread may become blocked in heavy cases, resulting in visible freezing or stuttering of the user interface.

https://dart.dev/language/isolateshttps://dart.dev/language/isolates
It'd be beneficial if we could consider offloading intensive animation calculations to a Dart Isolate. This approach would allow the main thread to remain responsive, ensuring smooth UI updates regardless of the complexity of the animation logic. The Isolate would handle the heavy computation and return results to the main thread for rendering on the canvas.
Considerations
- Data Transfer: Using
SendPort/ReceivePort for heavy data passing could overhead (ex_ animation frame data)
- Solution: Passing
ffi.Pointer<FlutterLottieAnimation> rather than original buffer would not take much
- Using multipel concurrency model: If both Dart Isolate and native threading are combined, issues like race conditions, synchronization challenges, and increased debugging complexity may arise.
Currently, when ThorVG.flutter performs animation rendering via FFI, the main UI thread may become blocked in heavy cases, resulting in visible freezing or stuttering of the user interface.
https://dart.dev/language/isolateshttps://dart.dev/language/isolates
It'd be beneficial if we could consider offloading intensive animation calculations to a Dart Isolate. This approach would allow the main thread to remain responsive, ensuring smooth UI updates regardless of the complexity of the animation logic. The Isolate would handle the heavy computation and return results to the main thread for rendering on the canvas.
Considerations
SendPort/ReceivePortfor heavy data passing could overhead (ex_ animation frame data)ffi.Pointer<FlutterLottieAnimation>rather than original buffer would not take much