Skip to content

Commit 89df480

Browse files
committed
Remove js-interop workaround
Dart 3.3 had the problem of some JS-interop methods declared to return a `JSBoolean` actually returning a Dart `bool`, causing compilation errors. Now that dart-lang/sdk#55024 has been fixed in Dart 3.4, the workarounds introduced to fix the issue can be reverted.
1 parent 6f5aa2d commit 89df480

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

sqlite3/example/web/worker.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ void main() {
1818
Future<void> handleEvent(web.MessageEvent event) async {
1919
final data = event.data;
2020

21-
// should be toDart, https://github.com/dart-lang/sdk/issues/55024
22-
if (data.equals('start'.toJS) as bool) {
21+
if (data.equals('start'.toJS).toDart) {
2322
final options = WasmVfs.createOptions();
2423
final worker = web.Worker(''); // Clone this worker
2524
worker.postMessage(options);

sqlite3/lib/src/wasm/js_interop/core.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ extension type JsBigInt(JSBigInt _jsBigInt) implements JSBigInt {
3333
const maxSafeInteger = 9007199254740992;
3434
const minSafeInteger = -maxSafeInteger;
3535

36-
// These should use toDart instead of as bool after
37-
// https://github.com/dart-lang/sdk/issues/55024
38-
return minSafeInteger.toJS.lessThanOrEqualTo(_jsBigInt) as bool &&
39-
_jsBigInt.lessThanOrEqualTo(maxSafeInteger.toJS) as bool;
36+
return minSafeInteger.toJS.lessThanOrEqualTo(_jsBigInt).toDart &&
37+
_jsBigInt.lessThanOrEqualTo(maxSafeInteger.toJS).toDart;
4038
}
4139

4240
Object toDart() {

sqlite3/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ homepage: https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3
55
issue_tracker: https://github.com/simolus3/sqlite3.dart/issues
66

77
environment:
8-
sdk: '>=3.3.0 <4.0.0'
8+
sdk: '>=3.4.0 <4.0.0'
99

1010
# This package supports all platforms listed below.
1111
platforms:

0 commit comments

Comments
 (0)