You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to encode an image to AVIF in isolate using compute but it shows the following error:
Unhandled Exception: LateInitializationError: Field 'api' has not been initialized. FlutterAvifPlatform.api (package:flutter_avif_platform_interface/flutter_avif_platform_interface.dart) encodeAvif (package:flutter_avif/src/avif_encoder.dart:16:53)
The text was updated successfully, but these errors were encountered:
Hi, error you are getting can be solved by calling DartPluginRegistrant.ensureInitialized() before using the plugin. But after that you will encounter other errors. The real issue here is that encodeAvif function uses dart:ui package to read images as rgba and dart:ui does not work in isolates. So you cannot use encodeAvif in an isolate.
I was trying to encode an image to AVIF in isolate using compute but it shows the following error:
Unhandled Exception: LateInitializationError: Field 'api' has not been initialized.
FlutterAvifPlatform.api (package:flutter_avif_platform_interface/flutter_avif_platform_interface.dart)
encodeAvif (package:flutter_avif/src/avif_encoder.dart:16:53)
The text was updated successfully, but these errors were encountered: