Repository: flutter
Issue: [vector_graphics] ffi imported when compiling for web wasm
Labels: package,p: vector_graphics

_Imported from https://github.com/dnfield/vector_graphics/issues/244_

Original report by @flrnsbt on Jun 10, 2024

../../../../../../.pub-cache/hosted/pub.dev/vector_graphics_compiler-1.1.11+1/lib/src/svg/_tessellator_ffi.dart:6:1: Error: 'dart:ffi' can't be
imported when compiling to Wasm.
import 'dart:ffi' as ffi;

---
Comment by @flrnsbt on Jun 10, 2024
Works well with javascript web

---
Comment by @tusharbhambere on Jun 10, 2024
+1

---
Comment by @luckyhandler on Jun 11, 2024
Happens with `Flutter 3.22.2` but not with `Flutter 3.22.1`, so downgrading Flutter to 3.22.1 is currently a workaround

---
Comment by @NotTsunami on Jun 12, 2024
This is currently breaking our build pipeline as well, downgrading to 3.22.1 fixed it

---
Comment by @trunghieuvn on Jun 22, 2024
> Happens with `Flutter 3.22.2` but not with `Flutter 3.22.1`, so downgrading Flutter to 3.22.1 is currently a workaround

thank for sharing, I work well build success with `flutter 3.22.1`

---
Comment by @chandrabezzo on Jun 24, 2024
Hi, any another workaround instead of we downgrade to Flutter 3.22.1. I think that solution just for short term only, we need to fixed it for long term solution? Because Flutter SDK will always upgraded?

---
Comment by @Trung15010802 on Jun 27, 2024
any updates?

---
Comment by @nohli on Jun 27, 2024
You can use one of these overrides in your `pubspec.yaml`:
Please confirm if it works for you, and the compile target platform you've tested (the more, the better).

```
dependency_overrides:
  vector_graphics_compiler:
    git:
      url: https://github.com/nohli/vector_graphics
      path: packages/vector_graphics_compiler
      ref: js_interop
```

```
dependency_overrides:
  vector_graphics_compiler:
    git:
      url: https://github.com/nohli/vector_graphics
      path: packages/vector_graphics_compiler
      ref: io
```

---
Comment by @Trung15010802 on Jun 28, 2024
> You can use one of these overrides in your `pubspec.yaml`: Please confirm if it works for you, and the platform you've tested (the more, the better).
> 
> ```
> dependency_overrides:
>   vector_graphics_compiler:
>     git:
>       url: https://github.com/nohli/vector_graphics
>       path: packages/vector_graphics_compiler
>       ref: js_interop
> ```
> 
> ```
> dependency_overrides:
>   vector_graphics_compiler:
>     git:
>       url: https://github.com/nohli/vector_graphics
>       path: packages/vector_graphics_compiler
>       ref: io
> ```

Neither works for me
![image](https://github.com/dnfield/vector_graphics/assets/90593296/817b84ac-c1c9-422c-8a1b-d0216c657b6d)



---
Comment by @nohli on Jun 28, 2024
> Neither works for me
> 
> ![image](https://github.com/dnfield/vector_graphics/assets/90593296/817b84ac-c1c9-422c-8a1b-d0216c657b6d)
> 
> 
> 
> 

We need to differentiate. This issue is not caused by `vector_graphics`, but by `win32`.

Is it possible that you are importing it transitively through another package?

---
Comment by @Trung15010802 on Jun 28, 2024
Thank you for your support! I will open a issue in `win32 `package

---
Comment by @uldall on Jul 1, 2024
I tried this override:
```
dependency_overrides:
  vector_graphics_compiler:
    git:
      url: https://github.com/nohli/vector_graphics
      path: packages/vector_graphics_compiler
      ref: js_interop
```

and it solved the issue when running `flutter build web --wasm` on Linux.

---
Comment by @nohli on Jul 18, 2024
This is [fixed](https://github.com/dart-lang/sdk/issues/55979) in the latest Flutter stable release [3.22.3](https://groups.google.com/g/flutter-announce/c/zThj7-7rQhs/m/Zm933NaLDAAJ).