Skip to content

Commit

Permalink
remove ffi dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
miDeb committed May 20, 2023
1 parent 274dcb1 commit 84143bc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 43 deletions.
5 changes: 2 additions & 3 deletions lib/src/plaform/open_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'dart:io';

import 'package:flutter/services.dart';
import 'package:open_file/src/common/open_result.dart';
import 'windows.dart' as windows;

class OpenFile {
static const MethodChannel _channel = const MethodChannel('open_file');
Expand All @@ -14,15 +13,15 @@ class OpenFile {
{String? type, String? uti, String linuxDesktopName = "xdg"}) async {
if (!Platform.isIOS && !Platform.isAndroid) {
int _result;
if (Platform.isMacOS) {
if (Platform.isMacOS || Platform.isWindows) {
final process = await Process.start("open", [filePath]);
_result = await process.exitCode;
} else if (Platform.isLinux) {
final process =
await Process.start("$linuxDesktopName-open", [filePath]);
_result = await process.exitCode;
} else {
_result = windows.shellExecute('open', filePath);
throw UnsupportedError("Unsupported platform");
}
return OpenResult(
type: _result == 0 ? ResultType.done : ResultType.error,
Expand Down
39 changes: 0 additions & 39 deletions lib/src/plaform/windows.dart

This file was deleted.

1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ homepage: https://github.com/crazecoder/open_file
dependencies:
flutter:
sdk: flutter
ffi: ^1.0.0

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 84143bc

Please sign in to comment.