bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
230 stars 120 forks source link

Support dart2wasm #221

Closed leecommamichael closed 3 months ago

leecommamichael commented 6 months ago

To reproduce:

../../../AppData/Local/Pub/Cache/hosted/pub.dev/pointycastle-3.7.4/lib/src/platform_check/node_crypto.dart:5:1: Error: JS interop library 'package:js/js.dart' can't be imported when compiling to Wasm. Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead. import 'package:js/js.dart'; ^ ../../../AppData/Local/Pub/Cache/hosted/pub.dev/pointycastle-3.7.4/lib/src/platform_check/web.dart:5:1: Error: JS interop library 'package:js/js.dart' can't be imported when compiling to Wasm. Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead. import 'package:js/js.dart'; ^

This library impacts the popular package:image. I've filed a matching report with them here.

The-RootCause commented 5 months ago

Definitely needed since the package is used in many known packages making them unusable with Wasm. Thank you

konsultaner commented 5 months ago

I started porting my code to the web package to support wasm. It was quite hard to get into it, but finally got it. I might be able to help here.

I only saw 2 files where actual web code was written. Is that right? I could exchange the old package:js with package:web. That package:web is fully compatible with the dart2wasm compiler.

konsultaner commented 4 months ago

Dart fixed the blocking issue. If someone would take a look at my PR, this issue could be closed 😇

konsultaner commented 3 months ago

@leecommamichael this issue is fixed. You might want to close this issue.

Ephenodrom commented 3 months ago

Close as the PR is merged and live on pub.dev.