패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.6.5

better_open_file

Flutter에서 네이티브 앱을 호출하여 파일을 열고 문자열 결과를 반환할 수 있는 플러그인의 포크입니다. iOS(UTI)/Android(intent)/PC(ffi)/Web(dart:html)을 지원합니다.

AndroidiOS
30일 다운로드
1.2천
좋아요
42
Pub 점수
140

패키지 설치

flutter pub add better_open_file

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

better_open_file은 여러 플랫폼에서 네이티브 시스템 앱을 사용하여 파일을 열 수 있도록 해주는 Flutter 플러그인의 포크입니다. iOS는 UTI를 통해, Android는 Intent를 통해, 데스크톱은 FFI를 통해, 웹은 dart:html를 통해 지원합니다. 이 패키지는 작업 결과를 나타내는 문자열 결과를 반환하므로 크로스플랫폼 애플리케이션에서 파일 실행 처리에 적합합니다. 간단함과 광범위한 호환성을 위해 설계되었으며, 원래 플러그인의 기능을 개선된 신뢰성과 플랫폼별 기능으로 확장합니다.

사용 사례

  • 네이티브 앱에서 PDF 및 문서 열기
  • Flutter 앱 내에서 파일 실행
  • 다양한 플랫폼 간 파일 미리보기 통합
  • 사용자 정의 핸들러로 파일 유형 처리
  • 모바일 및 데스크톱에서 파일 작업 지원

주요 기능

  • 크로스 플랫폼 파일 실행
  • 문자열 결과 피드백
  • iOS UTI 및 Android Intent 지원
  • FFI를 통한 데스크톱 통합
  • dart:html를 사용한 웹 호환성

적합한 대상

  • 파일 중심 앱을 개발하는 개발자
  • 네이티브 파일 처리가 필요한 앱
  • 크로스 플랫폼 파일 뷰어
  • 교육 또는 문서 관리 도구
  • iOS, Android 및 데스크톱을 대상으로 하는 프로젝트

고려 사항

  • 플랫폼별 구성이 필요합니다
  • 지원되는 파일 형식에만 제한됨
  • 일부 플랫폼에서는 추가 권한이 필요할 수 있습니다
  • 웹 지원은 브라우저 기능에 따라 달라집니다
  • 데스크톱 지원을 위해서는 적절한 FFI 설정이 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

better_open_file

pub package

NOTICE: This package is forked from here to remove a dangerous permission in android

What's was changed on this fork:

  • Updated to FFI 2.0.x
  • Removed android.permission.REQUEST_INSTALL_PACKAGES and android.permission.READ_EXTERNAL_STORAGE
  • Updated some Gradle configurations

A plug-in that can call native APP to open files with string result in flutter, support iOS(DocumentInteraction) / android(intent) / PC(ffi) / web(dart:html)

Usage

To use this plugin, add better_open_file as a dependency in your pubspec.yaml file.

dependencies:
  better_open_file: ^lastVersion

Example

import 'package:better_open_file/better_open_file.dart';

OpenFile.open("/sdcard/example.txt");
//OpenFile.open("/sdcard/example.txt", type: "text/plain", uti: "public.plain-text");

Support

android
{
            {".3gp",    "video/3gpp"},
            {".torrent","application/x-bittorrent"},
            {".kml",    "application/vnd.google-earth.kml+xml"},
            {".gpx",    "application/gpx+xml"},
            {".csv",    "application/vnd.ms-excel"},
            {".asf",    "video/x-ms-asf"},
            {".avi",    "video/x-msvideo"},
            {".bin",    "application/octet-stream"},
            {".bmp",    "image/bmp"},
            {".c",      "text/plain"},
            {".class",  "application/octet-stream"},
            {".conf",   "text/plain"},
            {".cpp",    "text/plain"},
            {".doc",    "application/msword"},
            {".docx",   "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
            {".xls",    "application/vnd.ms-excel"},
            {".xlsx",   "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
            {".exe",    "application/octet-stream"},
            {".gif",    "image/gif"},
            {".gtar",   "application/x-gtar"},
            {".gz",     "application/x-gzip"},
            {".h",      "text/plain"},
            {".htm",    "text/html"},
            {".html",   "text/html"},
            {".jar",    "application/java-archive"},
            {".java",   "text/plain"},
            {".jpeg",   "image/jpeg"},
            {".jpg",    "image/jpeg"},
            {".js",     "application/x-javascript"},
            {".log",    "text/plain"},
            {".m3u",    "audio/x-mpegurl"},
            {".m4a",    "audio/mp4a-latm"},
            {".m4b",    "audio/mp4a-latm"},
            {".m4p",    "audio/mp4a-latm"},
            {".m4u",    "video/vnd.mpegurl"},
            {".m4v",    "video/x-m4v"},
            {".mov",    "video/quicktime"},
            {".mp2",    "audio/x-mpeg"},
            {".mp3",    "audio/x-mpeg"},
            {".mp4",    "video/mp4"},
            {".mpc",    "application/vnd.mpohun.certificate"},
            {".mpe",    "video/mpeg"},
            {".mpeg",   "video/mpeg"},
            {".mpg",    "video/mpeg"},
            {".mpg4",   "video/mp4"},
            {".mpga",   "audio/mpeg"},
            {".msg",    "application/vnd.ms-outlook"},
            {".ogg",    "audio/ogg"},
            {".pdf",    "application/pdf"},
            {".png",    "image/png"},
            {".pps",    "application/vnd.ms-powerpoint"},
            {".ppt",    "application/vnd.ms-powerpoint"},
            {".pptx",   "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
            {".prop",   "text/plain"},
            {".rc",     "text/plain"},
            {".rmvb",   "audio/x-pn-realaudio"},
            {".rtf",    "application/rtf"},
            {".sh",     "text/plain"},
            {".tar",    "application/x-tar"},
            {".tgz",    "application/x-compressed"},
            {".txt",    "text/plain"},
            {".wav",    "audio/x-wav"},
            {".wma",    "audio/x-ms-wma"},
            {".wmv",    "audio/x-ms-wmv"},
            {".wps",    "application/vnd.ms-works"},
            {".xml",    "text/plain"},
            {".z",      "application/x-compress"},
            {".zip",    "application/x-zip-compressed"},
            {"",        "*/*"}
}

when Conflict with other plugins about FileProvider, add code below in your /android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="xxx.xxx.xxxxx">
    <application>
        ...
        <provider
                android:name="androidx.core.content.FileProvider"
                android:authorities="${applicationId}.fileProvider"
                android:exported="false"
                android:grantUriPermissions="true"
                tools:replace="android:authorities">
            <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/filepaths"
                    tools:replace="android:resource" />
        </provider>
    </application>
</manifest>

when Android dependency 'com.android.support:appcompat-v7' has different version for the compile error, add code below in your /android/build.gradle

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
}
IOS with UTI (DocumentInteraction Auto)
{
            {".rtf",    "public.rtf"},
            {".txt",    "public.plain-text"},
            {".html",   "public.html"},
            {".htm",    "public.html"},
            {".xml",    "public.xml"},
            {".tar",    "public.tar-archive"},
            {".gz",     "org.gnu.gnu-zip-archive"},
            {".gzip",   "org.gnu.gnu-zip-archive"},
            {".tgz",    "org.gnu.gnu-zip-tar-archive"},
            {".jpg",    "public.jpeg"},
            {".jpeg",   "public.jpeg"},
            {".png",    "public.png"},
            {".avi",    "public.avi"},
            {".mpg",    "public.mpeg"},
            {".mpeg",   "public.mpeg"},
            {".mp4",    "public.mpeg-4"},
            {".3gpp",   "public.3gpp"},
            {".3gp",    "public.3gpp"},
            {".mp3",    "public.mp3"},
            {".zip",    "com.pkware.zip-archive"},
            {".gif",    "com.compuserve.gif"},
            {".bmp",    "com.microsoft.bmp"},
            {".ico",    "com.microsoft.ico"},
            {".doc",    "com.microsoft.word.doc"},
            {".xls",    "com.microsoft.excel.xls"},
            {".ppt",    "com.microsoft.powerpoint.​ppt"},
            {".wav",    "com.microsoft.waveform-​audio"},
            {".wm",     "com.microsoft.windows-​media-wm"},
            {".wmv",    "com.microsoft.windows-​media-wmv"},
            {".pdf",    "com.adobe.pdf"}
}

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.