Skip to content

Commit

Permalink
fix(web): isolates not working on web (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
OutdatedGuy committed May 28, 2024
1 parent 9fd1a8f commit fa57142
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/internet_connection_checker_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ library internet_connection_checker_plus;

// Dart Packages
import 'dart:async';
import 'dart:isolate';

// Flutter Packages
import 'package:flutter/foundation.dart';

// Third Party Packages
import 'package:connectivity_plus/connectivity_plus.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/src/internet_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ class InternetConnection {
InternetCheckOption option,
) async {
try {
final response = await Isolate.run(() {
final response = await compute((_) {
return http
.head(option.uri, headers: option.headers)
.timeout(option.timeout);
});
}, null);

return InternetCheckResult(
option: option,
Expand Down

0 comments on commit fa57142

Please sign in to comment.