vector_graphics icon indicating copy to clipboard operation
vector_graphics copied to clipboard

ffi imported when compiling for web wasm

Open flrnsbt opened this issue 1 year ago • 13 comments

../../../../../../.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;

flrnsbt avatar Jun 10 '24 01:06 flrnsbt

Works well with javascript web

flrnsbt avatar Jun 10 '24 01:06 flrnsbt

+1

tusharbhambere avatar Jun 10 '24 20:06 tusharbhambere

Happens with Flutter 3.22.2 but not with Flutter 3.22.1, so downgrading Flutter to 3.22.1 is currently a workaround

luckyhandler avatar Jun 11 '24 12:06 luckyhandler

This is currently breaking our build pipeline as well, downgrading to 3.22.1 fixed it

NotTsunami avatar Jun 12 '24 17:06 NotTsunami

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

trunghieuvn avatar Jun 22 '24 17:06 trunghieuvn

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?

chandrabezzo avatar Jun 24 '24 04:06 chandrabezzo

any updates?

Trung15010802 avatar Jun 27 '24 09:06 Trung15010802

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

nohli avatar Jun 27 '24 13:06 nohli

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

Trung15010802 avatar Jun 28 '24 03:06 Trung15010802

Neither works for me

image

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?

nohli avatar Jun 28 '24 08:06 nohli

Thank you for your support! I will open a issue in win32 package

Trung15010802 avatar Jun 28 '24 09:06 Trung15010802

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.

uldall avatar Jul 01 '24 13:07 uldall

This is fixed in the latest Flutter stable release 3.22.3.

nohli avatar Jul 18 '24 18:07 nohli