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

패키지 상세v5.2.3

flutter_document_picker

사용자가 문서를 선택할 수 있도록 허용합니다. 선택한 문서는 앱의 임시 디렉터리로 복사됩니다. 선택적으로 특정 확장자만 가진 문서를 선택하도록 허용할 수 있습니다.

AndroidiOS
30일 다운로드
1.9만
좋아요
52
Pub 점수
150

패키지 설치

flutter pub add flutter_document_picker

패키지 개요

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

사용자가 장치의 파일 시스템에서 문서를 선택할 수 있도록 해주는 플러터 패키지입니다. 선택한 문서는 안전한 접근을 위해 자동으로 앱의 임시 디렉토리로 복사됩니다. 특정 확장자로 파일을 필터링하는 기능을 지원하여 타겟 파일 선택의 사용성을 향상시킵니다. 안드로이드 및 iOS 모두에서 사용 가능하며 네이티브 파일 피커와 원활하게 통합됩니다. 직접 파일 시스템에 접근하지 않고도 문서 업로드 또는 가져오기가 필요한 앱에 적합합니다.

사용 사례

  • 양식 내 문서 업로드
  • 사용자 생성 파일 가져오기
  • 앱 간 파일 공유
  • 외부 구성 파일 읽기
  • 문서 기반 워크플로우 지원

주요 기능

  • 확장자 필터링을 사용하여 문서 선택
  • 자동으로 파일을 임시 디렉터리로 복사합니다
  • 크로스 플랫폼(안드로이드 및 iOS)
  • 간단한 API 통합
  • 보안 임시 파일 처리

적합한 대상

  • 파일 입력이 필요한 앱
  • 문서 관리 기능
  • 사용자 중심의 파일 가져오기
  • 모바일 데이터 수집 도구
  • 개인정보 보호 중심의 파일 액세스

고려 사항

  • 파일이 일시 저장소로 복사됩니다
  • 지원되는 파일 형식에만 제한됨
  • 플랫폼별 권한이 필요합니다
  • 임시 파일은 앱 재시작 시 삭제될 수 있습니다
  • 원본 파일 경로에 직접 액세스할 수 없습니다

원본 README

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

flutter_document_picker

Allows user pick a document. Picked document is copied to app temporary directory. Optionally allows pick document with specific extension only.

When file is picked its extension is checked using allowedFileExtensions parameter. Then file is copied to app temp directory. Copied file path is returned as result. If picked file extension is not in allowedFileExtensions list then extension_mismatch error is returned.

In Android Intent.ACTION_OPEN_DOCUMENT is used. This intent is supported only from Android 19 (KitKat) SDK version. So this plugin can be used only if app minSdkVersion is 19 or more.

In iOS UIDocumentPickerViewController is used. Files can be filtered by list of UTI types using allowedUtiTypes parameter. Picked file path is returned as result.

Params

Plugin has 3 optional parameters to help pick only specific document type:

  • List<String> allowedUtiTypes (used only in iOS)

    In iOS Uniform Type Identifiers is used to check document types. If list is null or empty "public.data" document type will be provided. Only documents with provided UTI types will be enabled in iOS document picker.

    More info: https://developer.apple.com/library/archive/qa/qa1587/_index.html

  • List<String> allowedFileExtensions (used both in iOS and in Android)

    List of file extensions that picked file should have. If list is null or empty - picked document extension will not be checked.

  • List<String> allowedMimeTypes (used only in Android)

    Only files with provided MIME types will be shown in document picker. If list is null or empty - */* MIME type will be used.

  • List<String> invalidFileNameSymbols (used both in iOS and in Android)

    List symbols that will be sanitized to "_" in the selected document name. I.e. Google Drive allows symbol '/' in the document name, but this symbol is not allowed in file name that will be saved locally.

    Default list: ['/'].

    Example: file name 'Report_2018/12/08.txt' will be replaced to 'Report_2018_12_08.txt'

Example

//Without parameters:
final path = await FlutterDocumentPicker.openDocument();
  
  ...

    
//With parameters:
FlutterDocumentPickerParams params = FlutterDocumentPickerParams(      
  allowedFileExtensions: ['mwfbak'],
  allowedUtiTypes: ['com.sidlatau.example.mwfbak'],
  allowedMimeTypes: ['application/*'],
  invalidFileNameSymbols: ['/'],
);

final path = await FlutterDocumentPicker.openDocument(params: params);

//Pick multiple files:
final paths = await FlutterDocumentPicker.openDocuments(params: params);

카테고리

소스 저장소

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

아직 데이터가 없습니다.