Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/open_filex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
7 changes: 2 additions & 5 deletions lib/src/web/web.dart
Original file line number Diff line number Diff line change
@@ -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<bool> open(String uri) async {
return window
.resolveLocalFileSystemUrl(uri)
.then((_) => true)
.catchError((e) => false);
return false;
}
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
flutter:
sdk: flutter
ffi: ^2.0.1
web: ^0.5.0

dev_dependencies:
flutter_lints: ^2.0.1
Expand All @@ -31,4 +32,4 @@ flutter:
macos:
default_package: open_filex
web:
default_package: open_filex
default_package: open_filex