From bc95ca2ce6a363c86cddb0a9c1d622af63ed6a5e Mon Sep 17 00:00:00 2001 From: Rami Al-Dhafiri Date: Sun, 7 Jul 2024 12:17:42 +0300 Subject: [PATCH 1/3] Update pubspec.yaml --- pubspec.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 080e881c..52217208 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,6 +7,7 @@ dependencies: flutter: sdk: flutter ffi: ^2.0.1 + web: ^0.5.0 dev_dependencies: flutter_lints: ^2.0.1 @@ -31,4 +32,4 @@ flutter: macos: default_package: open_filex web: - default_package: open_filex \ No newline at end of file + default_package: open_filex From 44a9700aedc3ae7bfacd043cbc2dacbf4feb394d Mon Sep 17 00:00:00 2001 From: Rami Al-Dhafiri Date: Sun, 7 Jul 2024 12:18:00 +0300 Subject: [PATCH 2/3] Update open_filex.dart --- lib/open_filex.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open_filex.dart b/lib/open_filex.dart index 98157faf..db047382 100644 --- a/lib/open_filex.dart +++ b/lib/open_filex.dart @@ -5,4 +5,4 @@ export 'src/common/open_result.dart'; /// Use platform specific codes or use web if it's the web export 'src/platform/open_filex.dart' - if (dart.library.html) 'src/web/open_filex.dart'; + if (dart.library.js_interop) 'src/web/open_filex.dart'; From ac2fe2d9af55a9e3b23363f9d9e49e9316232cb4 Mon Sep 17 00:00:00 2001 From: Rami Al-Dhafiri Date: Sun, 7 Jul 2024 12:31:44 +0300 Subject: [PATCH 3/3] Update web.dart --- lib/src/web/web.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/src/web/web.dart b/lib/src/web/web.dart index d9804bd9..17665d5e 100644 --- a/lib/src/web/web.dart +++ b/lib/src/web/web.dart @@ -1,12 +1,9 @@ import 'dart:async'; // ignore: avoid_web_libraries_in_flutter -import 'dart:html'; +import 'package:web/web.dart'; /// Open your file with [uri] on the web Future open(String uri) async { - return window - .resolveLocalFileSystemUrl(uri) - .then((_) => true) - .catchError((e) => false); + return false; }