From a75f7b22d65bba2c96d5cc7ab4ce7fa6682bee18 Mon Sep 17 00:00:00 2001 From: Dominik Toton Date: Fri, 31 Oct 2025 14:03:26 +0100 Subject: [PATCH] fix: allow to use browser cryptography when in wasm --- cryptography/lib/browser.dart | 2 +- cryptography/lib/cryptography_plus.dart | 2 +- cryptography/lib/src/dart/blake2b.dart | 2 +- cryptography/lib/src/helpers/random_bytes.dart | 2 +- cryptography_flutter/lib/src/_internal.dart | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cryptography/lib/browser.dart b/cryptography/lib/browser.dart index af3dd5a9..e36316c5 100644 --- a/cryptography/lib/browser.dart +++ b/cryptography/lib/browser.dart @@ -20,4 +20,4 @@ library; export 'src/browser/browser_cryptography_when_not_browser.dart' - if (dart.library.html) 'src/browser/browser_cryptography.dart'; + if (dart.library.js_interop) 'src/browser/browser_cryptography.dart'; diff --git a/cryptography/lib/cryptography_plus.dart b/cryptography/lib/cryptography_plus.dart index 1fe8ffa1..35672f27 100644 --- a/cryptography/lib/cryptography_plus.dart +++ b/cryptography/lib/cryptography_plus.dart @@ -29,7 +29,7 @@ library; import 'package:cryptography_plus/cryptography_plus.dart'; export 'src/browser/browser_cryptography_when_not_browser.dart' - if (dart.library.html) 'src/browser/browser_cryptography.dart'; + if (dart.library.js_interop) 'src/browser/browser_cryptography.dart'; export 'src/cryptography/algorithms.dart'; export 'src/cryptography/cipher.dart'; export 'src/cryptography/cipher_state.dart'; diff --git a/cryptography/lib/src/dart/blake2b.dart b/cryptography/lib/src/dart/blake2b.dart index e40fe8fa..d08a7eb7 100644 --- a/cryptography/lib/src/dart/blake2b.dart +++ b/cryptography/lib/src/dart/blake2b.dart @@ -16,7 +16,7 @@ import 'package:cryptography_plus/cryptography_plus.dart'; import 'package:cryptography_plus/dart.dart'; import 'blake2b_impl_vm.dart' - if (dart.library.html) 'blake2b_impl_browser.dart'; + if (dart.library.js_interop) 'blake2b_impl_browser.dart'; /// [Blake2b] implemented in pure Dart. /// diff --git a/cryptography/lib/src/helpers/random_bytes.dart b/cryptography/lib/src/helpers/random_bytes.dart index b5dd0b16..59c638ed 100644 --- a/cryptography/lib/src/helpers/random_bytes.dart +++ b/cryptography/lib/src/helpers/random_bytes.dart @@ -20,7 +20,7 @@ import 'package:cryptography_plus/helpers.dart'; import '../../cryptography_plus.dart'; export 'random_bytes_impl_default.dart' - if (dart.library.html) 'random_bytes_impl_browser.dart'; + if (dart.library.js_interop) 'random_bytes_impl_browser.dart'; const _hexChars = [ '0', diff --git a/cryptography_flutter/lib/src/_internal.dart b/cryptography_flutter/lib/src/_internal.dart index 836912e4..97812ede 100644 --- a/cryptography_flutter/lib/src/_internal.dart +++ b/cryptography_flutter/lib/src/_internal.dart @@ -19,10 +19,10 @@ import 'package:flutter/services.dart'; import '../cryptography_flutter_plus.dart'; import '_internal_impl_non_browser.dart' - if (dart.library.html) '_internal_impl_browser.dart'; + if (dart.library.js_interop) '_internal_impl_browser.dart'; export '_internal_impl_non_browser.dart' - if (dart.library.html) '_internal_impl_browser.dart'; + if (dart.library.js_interop) '_internal_impl_browser.dart'; const MethodChannel _methodChannel = MethodChannel('cryptography_flutter');