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'; 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; } 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