From 03760f5183a1979b4bad233c3fa37f40b13a135e Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 18 Sep 2025 04:13:46 +0330 Subject: [PATCH] fix(llc): Fixed build in dart2wasm environment According to https://dart.dev/interop/js-interop/past-js-interop we should now "prefer using dart:js_interop going forwards and migrate usages of old interop libraries when possible" and this change does that in order to make the library compatible with `--wasm` builds. --- packages/stream_chat/CHANGELOG.md | 1 + .../lib/src/core/platform_detector/platform_detector.dart | 2 +- .../lib/src/attachment/handler/stream_attachment_handler.dart | 2 +- .../stream_chat_persistence/lib/src/db/shared/shared_db.dart | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 5c37fbd91a..815188900f 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -16,6 +16,7 @@ - Fixed `OwnUser` specific fields getting lost when creating a new `OwnUser` instance from an `User` instance. - Fixed `Client.currentUser` specific fields getting reset on `user.updated` events. +- Fixed build in dart2wasm environment. ✅ Added diff --git a/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart b/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart index 593a967f90..33785d08b3 100644 --- a/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart +++ b/packages/stream_chat/lib/src/core/platform_detector/platform_detector.dart @@ -1,5 +1,5 @@ import 'package:stream_chat/src/core/platform_detector/platform_detector_stub.dart' - if (dart.library.html) 'platform_detector_web.dart' + if (dart.library.js_interop) 'platform_detector_web.dart' if (dart.library.io) 'platform_detector_io.dart'; /// Possible platforms diff --git a/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler.dart b/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler.dart index 36d45725f5..22288d489d 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler.dart @@ -1,4 +1,4 @@ export 'stream_attachment_handler_base.dart' - if (dart.library.html) 'stream_attachment_handler_html.dart' + if (dart.library.js_interop) 'stream_attachment_handler_html.dart' if (dart.library.io) 'stream_attachment_handler_io.dart' show StreamAttachmentHandler; diff --git a/packages/stream_chat_persistence/lib/src/db/shared/shared_db.dart b/packages/stream_chat_persistence/lib/src/db/shared/shared_db.dart index 25120fcff1..e125691fa9 100644 --- a/packages/stream_chat_persistence/lib/src/db/shared/shared_db.dart +++ b/packages/stream_chat_persistence/lib/src/db/shared/shared_db.dart @@ -1,3 +1,3 @@ export 'unsupported_db.dart' if (dart.library.io) 'native_db.dart' // implementation using dart:io - if (dart.library.html) 'web_db.dart'; + if (dart.library.js_interop) 'web_db.dart';