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
56 changes: 55 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
/open_file_mac/.idea/
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
**/.build/
.buildlog/
.history
.svn/
.swiftpm/
**/.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
**/.dart_tool/
**/.flutter-plugins
**/.flutter-plugins-dependencies
**/.pub-cache/
**/.pub/
**/build/
**/pubspec.lock

# Flutter generated files in plugin examples
**/android/local.properties
**/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/flutter_export_environment.sh
**/ios/Flutter/ephemeral/
**/ios/Runner/GeneratedPluginRegistrant.h
**/ios/Runner/GeneratedPluginRegistrant.m
**/linux/flutter/ephemeral/
**/linux/flutter/generated_plugin_registrant.cc
**/linux/flutter/generated_plugin_registrant.h
**/macos/Flutter/ephemeral/
**/windows/flutter/ephemeral/
**/windows/flutter/generated_plugin_registrant.cc
**/windows/flutter/generated_plugin_registrant.h

# Android Studio build artifacts
**/android/app/debug
**/android/app/profile
**/android/app/release

coverage/
6 changes: 2 additions & 4 deletions open_file/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import 'package:permission_handler/permission_handler.dart';

void main() => runApp(MyApp());

const types = {
"application/pdf": "pdf",
".dwg": "application/x-autocad"
};
const types = {"application/pdf": "pdf", ".dwg": "application/x-autocad"};

class MyApp extends StatefulWidget {
@override
Expand All @@ -24,6 +21,7 @@ class _MyAppState extends State<MyApp> {
_openExternalImage();
}

// ignore: unused_element
_openOtherTypeFile() async {
final filePath = "/sdcard/Download/R-C.dwg";
final extension = path.extension(filePath);
Expand Down
3 changes: 0 additions & 3 deletions open_file_android/example/android/local.properties

This file was deleted.

16 changes: 5 additions & 11 deletions open_file_android/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@

import 'dart:typed_data';

import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:open_file_android/open_file_android.dart';
import 'package:permission_handler/permission_handler.dart';


void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
Expand All @@ -27,17 +23,13 @@ class _MyAppState extends State<MyApp> {
_openPickFile() async {
FilePickerResult? fileResult = await FilePicker.platform.pickFiles();
if (fileResult?.files.first != null) {
Uint8List? fileBytes = fileResult!.files.first.bytes;

final result =
await OpenFileAndroid().open(fileResult.files.first.path);
final result = await OpenFileAndroid().open(fileResult!.files.first.path);
setState(() {
_openResult = "type=${result.type} message=${result.message}";
});
}
}


// ignore: unused_element
_openAppPrivateFile() async {
//open an app private storage file
Expand All @@ -52,7 +44,8 @@ class _MyAppState extends State<MyApp> {
_openOtherAppFile() async {
//open an external storage image file on android 13
if (await Permission.manageExternalStorage.request().isGranted) {
final result = await OpenFileAndroid().open("/data/user/0/xxx/images/1.jpg");
final result =
await OpenFileAndroid().open("/data/user/0/xxx/images/1.jpg");
setState(() {
_openResult = "type=${result.type} message=${result.message}";
});
Expand Down Expand Up @@ -96,7 +89,8 @@ class _MyAppState extends State<MyApp> {
_openExternalFile() async {
//open an external storage file
if (await Permission.manageExternalStorage.request().isGranted) {
final result = await OpenFileAndroid().open("/sdcard/Android/data/R-C.xml");
final result =
await OpenFileAndroid().open("/sdcard/Android/data/R-C.xml");
setState(() {
_openResult = "type=${result.type} message=${result.message}";
});
Expand Down
2 changes: 0 additions & 2 deletions open_file_ios/example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>
43 changes: 0 additions & 43 deletions open_file_ios/example/ios/Podfile

This file was deleted.

22 changes: 0 additions & 22 deletions open_file_ios/example/ios/Podfile.lock

This file was deleted.

Loading