dnfield / vector_graphics

BSD 3-Clause "New" or "Revised" License
90 stars 45 forks source link

ffi imported when compiling for web wasm #244

Open flrnsbt opened 3 months ago

flrnsbt commented 3 months ago

../../../../../../.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 commented 3 months ago

Works well with javascript web

tusharbhambere commented 3 months ago

+1

luckyhandler commented 3 months ago

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

NotTsunami commented 3 months ago

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

trunghieuvn commented 3 months ago

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

chandrabezzo commented 3 months ago

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?

Trung15010802 commented 3 months ago

any updates?

nohli commented 3 months ago

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
Trung15010802 commented 3 months ago

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

nohli commented 3 months ago

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?

Trung15010802 commented 3 months ago

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

uldall commented 3 months ago

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.

nohli commented 2 months ago

This is fixed in the latest Flutter stable release 3.22.3.