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: The method 'instantiateImageCodec' isn't defined for the class 'PaintingBinding'. #8

Open
Taha-Firoz opened this issue Aug 21, 2024 · 1 comment

Comments

@Taha-Firoz
Copy link

I was trying to use this library in rendering my gifs. I am not using a controller, I'm just passing an ImageProvider without a controller.
I've attached my flutter doctor output and the complete error message.

I already had gifs rendering and working but I would need to evict them frequently because I have a variable number of gifs that render at once.

Transform.rotate(
  angle: rotation * pi / 180,
  child: 
  Image(
    image: imgSrc,
    width: 200,
    height: 200,
  ),
),

I swapped it to:

Transform.rotate(
  angle: rotation * pi / 180,
  child:
    Gif(
      image: imgSrc,
      autostart: Autostart.once,
      placeholder: (context) => const Text('Loading...'),
      onFetchCompleted: () {
      },
    )
),
AppData/Local/Pub/Cache/hosted/pub.dev/gif-2.2.0/lib/gif.dart:348:51: Error: The method 'instantiateImageCodec' isn't defined for the class 'PaintingBinding'.
 - 'PaintingBinding' is from 'package:flutter/src/painting/binding.dart' ('/C:/flutter/packages/flutter/lib/src/painting/binding.dart').
Try correcting the name to the name of an existing method, or defining a method named 'instantiateImageCodec'.
    Codec codec = await PaintingBinding.instance!.instantiateImageCodec(bytes);

Flutter Doctor:

[√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.22631.4037], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 2022.3)
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.92.2)
[√] Connected device (3 available)
[√] Network resources
@tigrenok00
Copy link

Same error here, flutter 3.16.0

Gif( image: AssetImage("assets/img/animation/ar_calib.gif"), fps: 30, ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants