google/webcrypto.dart

Add Flutter Desktop support

Closed this issue · 10 comments

Flutter desktop is becoming more common.

We should add support for flutter desktop.

just plain dart, not only flutter, right?

This package already works for Dart. This issue is about adding the right build steps for flutter run and flutter build for Flutter Desktop Windows/Linux/MacOS.

I am stuck with this problem - the workaround suggested by @prijindal here allows to run dart run webcrypto:setup and the build seems to succeed ("Package webcrypto now configured for use in your project."), but the test fails anyway with the message "Unsupported operation: package:webcrypto cannot be used from Dart or pub run test unless flutter pub run webcrypto:setup has been run for the current root project." and running this command fails with "Could not find a file named "pubspec.yaml" in "/Users/evgeny/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2". - maybe because it's not a flutter project?

I've managed to run flutter pub run webcrypto:setup but dart test doesn't work, I can only run flutter test...

What about MacOS and Windows?

rokk4 commented

@WiRight I was able to manually add libcrypto as .dylib and it works.
You can run the compilation on MacOS if you install all the deps.

I also tried it for windows, but I don't know shit about compiling BoringSSL/complicated C++ projects on Windows, so I could not make it work.

@dcharkes I think the biggest problem is setting up the build enviroment on windows, which is a pain in the ... Would it be a possibility to include precompiled BoringSSL? Or is this not a good idea because the user of the lib would then have to trust the precompiled .dll?

I think MacOS would not be such a big task.

I believe the build re-exports symbols so that they don't collide. Moreover, the build only uses a subset of BoringSSL which is smaller than the full BoringSSL. So, I don't believe we can use a precompiled dylib from BoringSSL directly.

The Windows setup should be very similar to the Linux setup, the builds are both CMake.
The MacOS setup should be very similar to the iOS setup, the builds are both CocoaPods.

This is very important to me. I was using pointycastle which was EXTREMELY slow in web. Switching to this was my solution, but now I miss the ability to develop on desktop.

The error that stops the setup script from working on Windows was fixed in 851ab99, but even with cmake and gcc, the build fails on Windows.

This is now resolved in version 0.5.4 which supports Android, iOS, Web, Windows, Linux and Mac.